parse-frontmatter-json.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { parseFrontmatterJsonText, materializeWireFrontmatter } from '../lib/parse-frontmatter-json.mjs'; |
| 4 | |
| 5 | test('plain object', () => { |
| 6 | assert.equal(parseFrontmatterJsonText('{"title":"x"}').title, 'x'); |
| 7 | }); |
| 8 | |
| 9 | test('BOM + object', () => { |
| 10 | assert.equal(parseFrontmatterJsonText('\uFEFF{"title":"x"}').title, 'x'); |
| 11 | }); |
| 12 | |
| 13 | test('JSON string whose value is JSON object text', () => { |
| 14 | const wire = JSON.stringify(JSON.stringify({ title: 'Hub probe', tags: 't' })); |
| 15 | const fm = parseFrontmatterJsonText(wire); |
| 16 | assert.equal(fm.title, 'Hub probe'); |
| 17 | assert.equal(fm.tags, 't'); |
| 18 | }); |
| 19 | |
| 20 | test('materialize passes object through', () => { |
| 21 | assert.equal(materializeWireFrontmatter({ a: 1 }).a, 1); |
| 22 | }); |
| 23 | |
| 24 | test('empty and legacy', () => { |
| 25 | assert.deepEqual(parseFrontmatterJsonText(''), {}); |
| 26 | assert.deepEqual(parseFrontmatterJsonText('{}'), {}); |
| 27 | }); |
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