mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 15:15:44 +01:00
Answer architecture round 3: the forecast never overcounts, the carry's JSON and the portable code block join through joinedWithin, and the list's choice of form stands in its own function
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, serializeCanonicalJsonWithin, spellsCanonicalJson } from './canonical-json.ts'
|
||||
import { serializeCanonicalJson, spellsCanonicalJson } from './canonical-json.ts'
|
||||
|
||||
test('sorts object keys recursively', () => {
|
||||
const value = { b: 1, a: { d: 2, c: 3 } }
|
||||
@@ -62,8 +62,3 @@ 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