Fix diff
Some checks failed
Check / build (pull_request) Failing after 3m57s

This commit is contained in:
Andras Schmelczer 2026-05-31 19:53:33 +01:00
commit 2623959c10

View file

@ -60,6 +60,21 @@ describe('reconcile', () => {
expect(result.text).toEqual('Hi world');
expect(result.history.length).toBeGreaterThan(0);
});
it('undiff accepts bigint entries (per the Array<number | bigint | string> type)', () => {
const original = 'Hello world';
const changed = 'Hello cruel world';
// `diff` returns plain numbers; emulate a caller that supplies BigInt, which
// the public signature permits. The wasm2js (React Native) build rejects raw
// BigInt, so the wrapper must normalise it to keep both backends identical.
const withBigints = diff(original, changed).map((item) =>
typeof item === 'number' ? BigInt(item) : item
);
expect(withBigints.some((item) => typeof item === 'bigint')).toBe(true);
expect(undiff(original, withBigints)).toEqual(changed);
});
});
describe('test_diff_and_undiff_are_inverse', () => {