Skip to content

Commit 6d166de

Browse files
committed
[patch] confirm undefined
1 parent 7c04715 commit 6d166de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,18 @@ describe('getDiff', () => {
133133
assert.equal(differenceFrom.a.from, null);
134134
assert.equal(differenceTo.a.to, null);
135135
});
136+
137+
it('should detect comparisons with defined undefined', () => {
138+
const differenceFrom = diffler({ a: undefined, b: 'things' }, { a: 'more', b: 'things' });
139+
const differenceTo = diffler({ a: 'some', b: 'things' }, { a: undefined, b: 'things' });
140+
const same = diffler({ a: undefined, b: 'things' }, { a: undefined, b: 'things' });
141+
142+
assert.equal(Object.keys(differenceFrom).length, 1);
143+
assert.equal(Object.keys(differenceTo).length, 1);
144+
assert.equal(Object.keys(same).length, 0);
145+
146+
assert.equal(differenceFrom.a.from, undefined);
147+
assert.equal(differenceTo.a.to, undefined);
148+
});
136149
});
137150
});

0 commit comments

Comments
 (0)