mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 15:15:44 +01:00
Refuse markdown past V8's longest string on every engine, before building it
This commit is contained in:
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import type { JsonValue } from './json-value.ts'
|
||||
import { serializeCanonicalJson, spellsCanonicalJson } from './canonical-json.ts'
|
||||
import { serializeCanonicalJson, serializeCanonicalJsonWithin, spellsCanonicalJson } from './canonical-json.ts'
|
||||
|
||||
test('sorts object keys recursively', () => {
|
||||
const value = { b: 1, a: { d: 2, c: 3 } }
|
||||
@@ -62,3 +62,8 @@ test('holds a text to the canonical spelling, whole', () => {
|
||||
assert.ok(!spellsCanonicalJson(value, 'two-space', '{"a":[1,2]}'))
|
||||
assert.ok(!spellsCanonicalJson(1e21, 'compact', '1e21'))
|
||||
})
|
||||
|
||||
test('spells canonical JSON up to a length, and nothing past it', () => {
|
||||
assert.equal(serializeCanonicalJsonWithin({ a: [1, 2] }, 'compact', 11), '{"a":[1,2]}')
|
||||
assert.equal(serializeCanonicalJsonWithin({ a: [1, 2] }, 'compact', 10), undefined)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user