Skip to content

Commit c761a81

Browse files
author
vdemedes
committed
switch to lodash.isEqual for deep quality check
1 parent 2c9fd51 commit c761a81

File tree

3 files changed

+85
-2
lines changed

3 files changed

+85
-2
lines changed

lib/assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var util = require('util');
33
var assert = require('core-assert');
4-
var deepEqual = require('not-so-shallow');
4+
var deepEqual = require('lodash.isequal');
55
var observableToPromise = require('observable-to-promise');
66
var isObservable = require('is-observable');
77
var isPromise = require('is-promise');

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"last-line-stream": "^1.0.0",
132132
"lodash.debounce": "^4.0.3",
133133
"lodash.difference": "^4.3.0",
134+
"lodash.isequal": "^4.4.0",
134135
"loud-rejection": "^1.2.0",
135136
"matcher": "^0.1.1",
136137
"max-timeout": "^1.0.0",

test/assert.js

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ test('.deepEqual()', function (t) {
199199
assert.deepEqual(x, y);
200200
});
201201

202-
t.doesNotThrow(function () {
202+
t.throws(function () {
203203
function Foo(a) {
204204
this.a = a;
205205
}
@@ -238,6 +238,88 @@ test('.deepEqual()', function (t) {
238238
assert.deepEqual({0: 'a', 1: 'b'}, ['a', 'b']);
239239
});
240240

241+
t.throws(function () {
242+
assert.deepEqual({a: 1}, {a: 1, b: undefined});
243+
});
244+
245+
t.throws(function () {
246+
assert.deepEqual(new Date('1972-08-01'), null);
247+
});
248+
249+
t.throws(function () {
250+
assert.deepEqual(new Date('1972-08-01'), undefined);
251+
});
252+
253+
t.doesNotThrow(function () {
254+
assert.deepEqual(new Date('1972-08-01'), new Date('1972-08-01'));
255+
});
256+
257+
t.doesNotThrow(function () {
258+
assert.deepEqual({x: new Date('1972-08-01')}, {x: new Date('1972-08-01')});
259+
});
260+
261+
t.throws(function () {
262+
assert.deepEqual(function a() {}, function a() {});
263+
});
264+
265+
t.doesNotThrow(function () {
266+
assert.deepEqual(undefined, undefined);
267+
assert.deepEqual({x: undefined}, {x: undefined});
268+
assert.deepEqual({x: [undefined]}, {x: [undefined]});
269+
});
270+
271+
t.doesNotThrow(function () {
272+
assert.deepEqual(null, null);
273+
assert.deepEqual({x: null}, {x: null});
274+
assert.deepEqual({x: [null]}, {x: [null]});
275+
});
276+
277+
t.doesNotThrow(function () {
278+
assert.deepEqual(0, 0);
279+
assert.deepEqual(1, 1);
280+
assert.deepEqual(3.14, 3.14);
281+
});
282+
283+
t.throws(function () {
284+
assert.deepEqual(0, 1);
285+
});
286+
287+
t.throws(function () {
288+
assert.deepEqual(1, -1);
289+
});
290+
291+
t.throws(function () {
292+
assert.deepEqual(3.14, 2.72);
293+
});
294+
295+
t.throws(function () {
296+
assert.deepEqual({0: 'a', 1: 'b'}, ['a', 'b']);
297+
});
298+
299+
t.doesNotThrow(function () {
300+
assert.deepEqual(
301+
[
302+
{foo: {z: 100, y: 200, x: 300}},
303+
'bar',
304+
11,
305+
{baz: {d: 4, a: 1, b: 2, c: 3}}
306+
],
307+
[
308+
{foo: {x: 300, y: 200, z: 100}},
309+
'bar',
310+
11,
311+
{baz: {c: 3, b: 2, a: 1, d: 4}}
312+
]
313+
);
314+
});
315+
316+
t.doesNotThrow(function () {
317+
assert.deepEqual(
318+
{x: {a: 1, b: 2}, y: {c: 3, d: 4}},
319+
{y: {d: 4, c: 3}, x: {b: 2, a: 1}}
320+
);
321+
});
322+
241323
// Regression test end here
242324

243325
t.doesNotThrow(function () {

0 commit comments

Comments
 (0)