This commit is contained in:
parent
3416264d6b
commit
2623959c10
1 changed files with 72 additions and 7 deletions
|
|
@ -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', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue