Record the guards' input boundary and Goal 8's size as JSON, and drop the hardening past it
This commit is contained in:
@@ -83,7 +83,7 @@ test("reads a node's siblings as a walk rather than as one call's arguments", ()
|
||||
assert.equal(fault(wide), 'accepted')
|
||||
})
|
||||
|
||||
test('refuses an object holding itself or a key it does not own, and accepts one shared', () => {
|
||||
test('refuses an object holding itself, and accepts one shared', () => {
|
||||
const holdsItself = 'an ADF document is a tree: an object in it holds itself'
|
||||
const paragraph: { content: unknown[]; type: string } = { content: [], type: 'paragraph' }
|
||||
paragraph.content.push(paragraph)
|
||||
@@ -96,26 +96,6 @@ test('refuses an object holding itself or a key it does not own, and accepts one
|
||||
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 notANode = "an ADF document's content holds ADF nodes: one of them is not"
|
||||
const inherits: { content?: unknown[] } = {}
|
||||
const heir: Record<string, unknown> = Object.create(inherits)
|
||||
heir['type'] = 'paragraph'
|
||||
inherits.content = [heir]
|
||||
assert.equal(fault({ content: [heir], type: 'doc', version: 1 }), notANode)
|
||||
const hidden: Record<string, unknown> = { type: 'paragraph' }
|
||||
Object.defineProperty(hidden, 'content', { value: [hidden] })
|
||||
assert.equal(fault({ content: [hidden], type: 'doc', version: 1 }), notANode)
|
||||
const link: Record<string, unknown> = Object.create({ attrs })
|
||||
link['type'] = 'link'
|
||||
assert.equal(fault({ content: [{ marks: [link], text: 'x', type: 'text' }], type: 'doc', version: 1 }), notANode)
|
||||
const indexed: unknown[] = []
|
||||
Object.defineProperty(indexed, 0, { value: indexed })
|
||||
assert.equal(fault({ content: [{ attrs: { a: indexed }, type: 'paragraph' }], type: 'doc', version: 1 }), holdsItself)
|
||||
const inheritedIndex: { content?: unknown[]; type: string } = { type: 'paragraph' }
|
||||
const heirs: unknown[] = Object.setPrototypeOf([], [inheritedIndex])
|
||||
heirs.length = 1
|
||||
inheritedIndex.content = heirs
|
||||
assert.equal(fault({ content: [inheritedIndex], type: 'doc', version: 1 }), holdsItself)
|
||||
const bold = { type: 'strong' }
|
||||
const text = { marks: [bold], text: 'x', type: 'text' }
|
||||
const shared = { content: [text, text], type: 'paragraph' }
|
||||
|
||||
Reference in New Issue
Block a user