summaryrefslogtreecommitdiff
path: root/value-equal/modules/__tests__/object-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'value-equal/modules/__tests__/object-test.js')
-rw-r--r--value-equal/modules/__tests__/object-test.js31
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);
+ });
+});