capture-inbox-payload.test.mjs
41 lines 1.8 KB
Raw
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
1 /**
2 * Pure payload builder for local + hosted capture (stable paths with fixed clock).
3 */
4
5 import { describe, it } from 'node:test';
6 import assert from 'node:assert/strict';
7 import { buildCaptureInboxWritePayload } from '../lib/capture-inbox.mjs';
8
9 describe('buildCaptureInboxWritePayload', () => {
10 /** Fixed instant; path time segment follows local `Date#getHours` like production capture. */
11 const fixed = new Date(Date.UTC(2026, 3, 18, 15, 30, 45));
12 const hh = String(fixed.getHours()).padStart(2, '0');
13 const mm = String(fixed.getMinutes()).padStart(2, '0');
14 const ss = String(fixed.getSeconds()).padStart(2, '0');
15 const tseg = `${hh}${mm}${ss}`;
16
17 it('builds default inbox path, body, and frontmatter', () => {
18 const o = buildCaptureInboxWritePayload('Hello World!', {}, fixed);
19 assert.equal(o.path, `inbox/2026-04-18-${tseg}-hello-world.md`);
20 assert.equal(o.body, 'Hello World!');
21 assert.equal(o.frontmatter.source, 'mcp-capture');
22 assert.equal(o.frontmatter.date, '2026-04-18');
23 assert.equal(o.frontmatter.inbox, true);
24 assert.equal(o.frontmatter.project, undefined);
25 assert.equal(o.frontmatter.tags, undefined);
26 });
27
28 it('honors source, project slug, and tags', () => {
29 const o = buildCaptureInboxWritePayload('Note body', { source: 'slack', project: 'Launch', tags: ['a', ' B '] }, fixed);
30 assert.equal(o.path, `projects/launch/inbox/2026-04-18-${tseg}-note-body.md`);
31 assert.equal(o.body, 'Note body');
32 assert.equal(o.frontmatter.source, 'slack');
33 assert.equal(o.frontmatter.project, 'launch');
34 assert.equal(o.frontmatter.tags, 'a, b');
35 });
36
37 it('uses project inbox directory when project is set', () => {
38 const o = buildCaptureInboxWritePayload('x', { project: 'My-Project' }, fixed);
39 assert.equal(o.path, `projects/my-project/inbox/2026-04-18-${tseg}-x.md`);
40 });
41 });
File History 5 commits
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
sha256:873e30b7fafe601346295f8f4289f388f21d8f715f28584d5481899ba2b714fc Merge pull request #249 from aaronrene/muse-mirror Agent 74 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 76 days ago
sha256:2827ba9e7632a4b141c50caf1e8f7d77abbc3515be20e7465f2bccb0ac4edf91 fix: repair endpoint now sets has_active_subscription when … Human minor 96 days ago