import { test } from 'node:test'; import assert from 'node:assert/strict'; import { ghostPostToRecord, type GhostPostLike } from './transform.js'; import { MARKPUB_MARKDOWN_TYPE } from './content-shape.js'; const PUBLICATION_URI = 'at://did:plc:example/site.standard.publication/self'; const basePost: GhostPostLike = { id: '64f0000000000000000000ab', title: 'Hello', slug: 'hello', status: 'published', published_at: '2026-07-06T10:00:00.000Z', html: '

Hi

Body text.

', }; test('record carries the markpub content member when the post has HTML', () => { const record = ghostPostToRecord(basePost, PUBLICATION_URI, null); const content = record.content as { $type: string; text: { markdown: string } }; assert.equal(content.$type, MARKPUB_MARKDOWN_TYPE); assert.match(content.text.markdown, /## Hi/); // textContent is untouched by this feature — both representations coexist. assert.match(String(record.textContent), /Body text\./); }); test('record omits content when the post has no HTML', () => { const record = ghostPostToRecord({ ...basePost, html: null }, PUBLICATION_URI, null); assert.ok(!('content' in record)); });