Answer product-owner round 1: name the cycle in its own message and in the error table

This commit is contained in:
2026-10-04 17:03:21 +02:00
parent 438bf8876b
commit addef08fa4
5 changed files with 31 additions and 12 deletions
+6 -6
View File
@@ -83,18 +83,18 @@ test("reads a node's siblings as a walk rather than as one call's arguments", ()
assert.equal(fault(wide), 'accepted')
})
test('refuses a document that holds itself, and accepts one sharing a node or a mark', () => {
const notANode = "an ADF document's content holds ADF nodes: one of them is not"
test('refuses a node or an attribute value holding itself, and accepts one shared', () => {
const holdsItself = 'an ADF document is a tree: a node or an attribute value holds itself'
const paragraph: { content: unknown[]; type: string } = { content: [], type: 'paragraph' }
paragraph.content.push(paragraph)
assert.equal(fault({ content: [paragraph], type: 'doc', version: 1 }), notANode)
assert.equal(fault({ content: [paragraph], type: 'doc', version: 1 }), holdsItself)
const document: { content: unknown[]; type: string; version: number } = { content: [], type: 'doc', version: 1 }
document.content.push(document)
assert.equal(fault(document), notANode)
assert.equal(fault(document), holdsItself)
const attrs: Record<string, unknown> = {}
attrs['a'] = [attrs]
assert.equal(fault({ content: [{ attrs, type: 'paragraph' }], type: 'doc', version: 1 }), notANode)
assert.equal(fault({ content: [{ marks: [{ attrs, type: 'link' }], text: 'x', type: 'text' }], type: 'doc', version: 1 }), notANode)
assert.equal(fault({ content: [{ attrs, type: 'paragraph' }], type: 'doc', version: 1 }), holdsItself)
assert.equal(fault({ content: [{ marks: [{ attrs, type: 'link' }], text: 'x', type: 'text' }], type: 'doc', version: 1 }), holdsItself)
assert.equal(isAdfDocument({ content: [{ attrs, type: 'paragraph' }], type: 'doc', version: 1 }), false)
const bold = { type: 'strong' }
const text = { marks: [bold], text: 'x', type: 'text' }