chore: import DH V2 D5.6.4 production baseline

This commit is contained in:
DH V2
2026-09-05 10:12:35 -03:00
commit 82213e72f5
757 changed files with 84218 additions and 0 deletions
@@ -0,0 +1,18 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { canonicalJson, sha256CanonicalJson } from '../../src/inspection-closing/canonical-json';
test('D5 canonical JSON sorts object keys recursively and preserves array order', () => {
const left = { z: 3, nested: { y: 2, x: 1 }, list: [{ b: 2, a: 1 }, 4] };
const right = { list: [{ a: 1, b: 2 }, 4], nested: { x: 1, y: 2 }, z: 3 };
assert.equal(canonicalJson(left), canonicalJson(right));
assert.equal(sha256CanonicalJson(left), sha256CanonicalJson(right));
assert.notEqual(sha256CanonicalJson(left), sha256CanonicalJson({ ...right, z: 4 }));
});
test('D5 canonical JSON serializes dates as ISO-8601', () => {
assert.equal(
canonicalJson({ at: new Date('2026-08-15T01:02:03.000Z') }),
'{"at":"2026-08-15T01:02:03.000Z"}',
);
});