mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Fix _.isEquals() for wrapped objects
This caught me out when writing some unit tests that use _.isEquals(). They were all passing even though I knew they shouldn't be, and I realised I was checking equality with a wrapped object that I'd forgotten to unwrap.
This commit is contained in:
@@ -45,13 +45,15 @@ $(document).ready(function() {
|
||||
ok(_.isEqual(moe, clone), 'deep equality is true');
|
||||
ok(_(moe).isEqual(clone), 'OO-style deep equality works');
|
||||
ok(!_.isEqual(5, NaN), '5 is not equal to NaN');
|
||||
ok(NaN != NaN, 'NaN is not equal to NaN (native equality)');
|
||||
ok(NaN !== NaN, 'NaN is not equal to NaN (native identity)');
|
||||
ok(NaN != NaN, 'NaN is not equal to NaN (native equality)');
|
||||
ok(NaN !== NaN, 'NaN is not equal to NaN (native identity)');
|
||||
ok(!_.isEqual(NaN, NaN), 'NaN is not equal to NaN');
|
||||
ok(_.isEqual(new Date(100), new Date(100)), 'identical dates are equal');
|
||||
ok(_.isEqual((/hello/ig), (/hello/ig)), 'identical regexes are equal');
|
||||
ok(!_.isEqual(null, [1]), 'a falsy is never equal to a truthy');
|
||||
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), 'object with the same number of undefined keys are not equal');
|
||||
ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), 'objects with the same number of undefined keys are not equal');
|
||||
ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'wrapped objects are not equal');
|
||||
equals(_({x: 1, y: 2}).chain().isEqual(_({x: 1, y: 2}).chain()).value(), true, 'wrapped objects are equal');
|
||||
});
|
||||
|
||||
test("objects: isEmpty", function() {
|
||||
|
||||
Reference in New Issue
Block a user