fix(utils): use browser compatible `deepEquals` (#4141)
- fix: use browser compatible `deepEquals` - removes use of node-specific deepEquality check - add a few unit tests for `deepEqual` and `deepCopy` --------- Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com> Co-authored-by: J M Rossy <jm.rossy@gmail.com>pull/4178/head
parent
ed65556aa4
commit
1474865ae1
@ -0,0 +1,5 @@ |
||||
--- |
||||
'@hyperlane-xyz/utils': patch |
||||
--- |
||||
|
||||
Replace `configDeepEquals` with improve `deepEquals` |
@ -0,0 +1,16 @@ |
||||
import { expect } from 'chai'; |
||||
|
||||
import { deepCopy, deepEquals } from './objects.js'; |
||||
|
||||
describe('Object utilities', () => { |
||||
it('deepEquals', () => { |
||||
expect(deepEquals({ a: 1, b: 2 }, { a: 1, b: 2 })).to.be.true; |
||||
expect(deepEquals({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).to.be.false; |
||||
expect(deepEquals({ a: 1, b: 2 }, { a: 1, b: 4 })).to.be.false; |
||||
}); |
||||
|
||||
it('deepCopy', () => { |
||||
expect(deepCopy({ a: 1, b: 2 })).to.eql({ a: 1, b: 2 }); |
||||
expect(deepCopy({ a: 1, b: 2 })).to.not.eql({ a: 1, b: 3 }); |
||||
}); |
||||
}); |
Loading…
Reference in new issue