diff options
author | Sebastian <sebasjm@gmail.com> | 2021-08-23 16:46:06 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2021-08-23 16:48:30 -0300 |
commit | 38acabfa6089ab8ac469c12b5f55022fb96935e5 (patch) | |
tree | 453dbf70000cc5e338b06201af1eaca8343f8f73 /value-equal/modules/__tests__/object-test.js | |
parent | f26125e039143b92dc0d84e7775f508ab0cdcaa8 (diff) | |
download | node-vendor-master.tar.gz node-vendor-master.tar.bz2 node-vendor-master.zip |
Diffstat (limited to 'value-equal/modules/__tests__/object-test.js')
-rw-r--r-- | value-equal/modules/__tests__/object-test.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/value-equal/modules/__tests__/object-test.js b/value-equal/modules/__tests__/object-test.js new file mode 100644 index 0000000..aa81831 --- /dev/null +++ b/value-equal/modules/__tests__/object-test.js @@ -0,0 +1,31 @@ +import valueEqual from 'value-equal'; + +describe('empty objects', () => { + it('returns true', () => { + expect(valueEqual({}, Object.create(null))).toBe(true); + }); +}); + +describe('objects with undefined values', () => { + it('returns false', () => { + expect(valueEqual({ a: undefined }, { b: 1 })).toBe(false); // #5 + }); +}); + +describe('objects with different constructors but the same properties', () => { + function A(a, b, c) { + this.a = a; + this.b = b; + this.c = c; + } + + function B(a, b, c) { + this.a = a; + this.b = b; + this.c = c; + } + + it('returns true', () => { + expect(valueEqual(new A(1, 2, 3), new B(1, 2, 3))).toBe(true); + }); +}); |