Files
Web_FreeCAD_Bitbybit/tests/fcstdRoundTrip.test.ts

7 lines
901 B
TypeScript

import { test } from 'node:test'
import assert from 'node:assert/strict'
import { compareFcstdRoundTrip, fingerprintRoundTrip } from '../src/facade/fcstdRoundTrip'
test('FCStd round-trip fingerprint is stable across object key order', () => { assert.equal(fingerprintRoundTrip({ b: 2, a: { d: 4, c: 3 } }), fingerprintRoundTrip({ a: { c: 3, d: 4 }, b: 2 })) })
test('FCStd round-trip comparison classifies unknown differences', () => { const pass = compareFcstdRoundTrip('box', 'web-freecad-web', { typeId: 'Part::Box', volume: 24 }, { volume: 24, typeId: 'Part::Box' }, ['shape', 'properties']); assert.equal(pass.status, 'pass'); const fail = compareFcstdRoundTrip('box', 'freecad-web-freecad', { typeId: 'Part::Box', volume: 24 }, { typeId: 'Part::Box', volume: 25 }, ['shape']); assert.equal(fail.status, 'fail-unknown-difference'); assert.equal(fail.differences[0].classification, 'unknown') })