export-note-record-to-content.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | import { test, describe } from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { exportNoteRecordToContent, exportNoteToContent } from '../lib/export.mjs'; |
| 4 | import fs from 'node:fs'; |
| 5 | import os from 'node:os'; |
| 6 | import path from 'node:path'; |
| 7 | |
| 8 | describe('exportNoteRecordToContent', () => { |
| 9 | test('produces md with yaml frontmatter and source_notes', () => { |
| 10 | const { content, filename } = exportNoteRecordToContent( |
| 11 | { body: 'Hello', frontmatter: { title: 'T', tags: ['a'] } }, |
| 12 | 'inbox/x.md', |
| 13 | { format: 'md' }, |
| 14 | ); |
| 15 | assert.equal(filename, 'x.md'); |
| 16 | assert.ok(content.includes('---\n')); |
| 17 | assert.ok(content.includes('source_notes')); |
| 18 | assert.ok(content.includes('Hello')); |
| 19 | }); |
| 20 | |
| 21 | test('exportNoteToContent delegates to same shape as record export', () => { |
| 22 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kt-exp-')); |
| 23 | const rel = 'a/b.md'; |
| 24 | const abs = path.join(dir, rel); |
| 25 | fs.mkdirSync(path.dirname(abs), { recursive: true }); |
| 26 | fs.writeFileSync( |
| 27 | abs, |
| 28 | '---\ntitle: One\ntags:\n - t\n---\nBody here\n', |
| 29 | 'utf8', |
| 30 | ); |
| 31 | const a = exportNoteToContent(dir, rel, { format: 'md' }); |
| 32 | const b = exportNoteRecordToContent( |
| 33 | { body: 'Body here', frontmatter: { title: 'One', tags: ['t'] } }, |
| 34 | rel, |
| 35 | { format: 'md' }, |
| 36 | ); |
| 37 | assert.equal(a.filename, b.filename); |
| 38 | assert.equal(a.content.replace(/\r?\n/g, '\n').trimEnd(), b.content.replace(/\r?\n/g, '\n').trimEnd()); |
| 39 | }); |
| 40 | }); |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago