3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-12 11:48:29 +01:00

Answer stability round 1: 0 🔴, 3 🟡 (0 misread); pin the stripped spaces after a marker, assert the writer's refusal, drop a code-derived expectation

This commit is contained in:
2026-11-09 00:09:15 +01:00
committed by Lillem4n
parent d341da0a29
commit 4b314725d8
2 changed files with 10 additions and 4 deletions
@@ -504,9 +504,11 @@ test('writes a task list nested to the deepest level the reader carries, and ref
assert.equal(written.split('\n').length, largestNesting + 1)
const refused = adfToPortableMarkdown(document(nested(largestNesting + 1)))
assert.deepEqual(refused.ok ? undefined : [refused.error.code, refused.error.path], ['unsupported-nesting-depth', ['content', 0, ...Array.from({ length: largestNesting }, () => ['content', 1]).flat(), 'content', 0]])
const quoted = (levels: number): string => portable(node('panel', { panelType: 'info' }, nested(levels)))
assert.ok(portableMarkdownToAdf(quoted(largestNesting - 1)).ok)
assert.match(quoted(largestNesting), /^unsupported-nesting-depth at \//)
const quoted = (levels: number) => adfToPortableMarkdown(document(node('panel', { panelType: 'info' }, nested(levels))))
const fits = quoted(largestNesting - 1)
assert.ok(fits.ok && portableMarkdownToAdf(fits.value).ok)
const crowded = quoted(largestNesting)
assert.equal(crowded.ok ? undefined : crowded.error.code, 'unsupported-nesting-depth')
})
test('writes a task list nested in the task before it, and more than one beside each other in that task', () => {
@@ -224,6 +224,11 @@ test('keeps a backslash a title line ends in as text, a break only before a foll
assert.deepEqual(read('> [!NOTE]- x\\\\\n> body\n'), [node('expand', { title: 'x\\' }, said('body'))])
})
test('strips every space and tab after a callout marker, whatever the callout', () => {
assert.deepEqual(read('> [!faq]- \t t\n'), [node('expand', { title: 't' }, paragraph())])
assert.deepEqual(read('> [!NOTE] \t first\n>\n> x\n'), [panel('info', said('first'), said('x'))])
})
test('keeps the target of a link in a title whichever marks sit beside the link', () => {
const titled = (markdown: string): unknown => {
const blocks = read(markdown)
@@ -271,7 +276,6 @@ test('places a refusal in a bullet list by the list and the item holding it', ()
test('reads a task whose marker line holds only breaks and spaces by the lines after it', () => {
assert.deepEqual(read('- [ ] a\n b\n'), [bare('taskList', task('TODO', text('a b')))])
assert.deepEqual(read('- [ ] \\\n \\\n x\n'), [bare('taskList', task('TODO', text('x')))])
assert.deepEqual(read('- [x]\n\n Second.\n- [ ] Next\n'), [bare('taskList', task('DONE', text('Second.')), task('TODO', text('Next')))])
assert.deepEqual(read('- [x]\n\n First.\n\n Second.\n'), [bare('taskList', node('blockTaskItem', { state: 'DONE' }, said('First.'), said('Second.')))])
assert.deepEqual(read('- [x]\n- [ ]\n'), [bare('taskList', task('DONE'), task('TODO'))])