3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 15:15:44 +01:00

Answer stability round 1: 0 🔴, 2 🟡 (0 misread); drop tryTaskList's dead child paths and splitTaskList's dead check, and group children in place of a list node

This commit is contained in:
2026-11-09 06:16:12 +01:00
committed by Lillem4n
parent 6b2693d385
commit 256f8f453f
5 changed files with 15 additions and 28 deletions
+1 -9
View File
@@ -4,16 +4,8 @@ import test from 'node:test'
import { portableWriting } from './block-spelling.ts'
import { writeMarkdown } from '../emit/adf-to-markdown.ts'
test('refuses a task list a child other than a task opens, where the portable reduction would have left none', () => {
test('refuses a task list that opens with a child other than a task', () => {
const list = { content: [{ content: [{ text: 'stray', type: 'text' }], type: 'paragraph' }, { attrs: { state: 'TODO' }, type: 'taskItem' }], type: 'taskList' }
const written = writeMarkdown({ content: [{ type: 'rule' }, list], type: 'doc', version: 1 }, portableWriting)
assert.deepEqual(written.ok ? written.value : [written.error.code, written.error.path], ['unsupported-node-shape', ['content', 1]])
})
test('names the path of a failure inside a task list by the child it writes', () => {
const task = { attrs: { state: 'TODO' }, content: [{ text: 't', type: 'text' }], type: 'taskItem' }
const unwritable = { attrs: { state: 'TODO' }, content: [{ marks: [{ type: 'strong' }, { type: 'strong' }], text: 'x', type: 'text' }], type: 'taskItem' }
const list = { content: [task, { content: [task], type: 'taskList' }, unwritable], type: 'taskList' }
const written = writeMarkdown({ content: [list], type: 'doc', version: 1 }, portableWriting)
assert.deepEqual(written.ok ? written.value : written.error.path, ['content', 0, 'content', 2, 'content', 0])
})