chore: assert.deepEqual => assert.deepStrictEqual#179
Conversation
63b122e to
fb57380
Compare
|
The root cause of why this PR was causing the tests to fail is summarized in the code below. I used const assert = require('assert');
const util = require('util');
const stringify = require('json-stable-stringify');
class SomeClass {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
const ob1 = new SomeClass(1, 2);
const ob2 = {
x: 1,
y: 2
};
assert.deepEqual(ob1, ob2); // true
assert.deepStrictEqual(ob1, ob2); // false
// This also does a deep check that works in the situation
// when `assert.deepStrictEqual` fails.
assert.strictEqual(stringify(ob1), stringify(ob2)); // true |
baf018e to
c86325e
Compare
JustinBeckwith
left a comment
There was a problem hiding this comment.
In general, it feels like you're using deepStrictEqual in a lot of places where assert.strictEqual would be sufficient.
| assert.ifError(err); | ||
| assert(is.object(response)); | ||
| assert.deepEqual(body, {}); | ||
| deepStrictEqual(body, {}); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| it('Should assign the value to the method property', () => { | ||
| ric.setMethod(VALID_STRING_INPUT); | ||
| assert.deepEqual(ric.method, VALID_STRING_INPUT); | ||
| deepStrictEqual(ric.method, VALID_STRING_INPUT); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
c86325e to
4f04428
Compare
|
@JustinBeckwith PTAL |
deepEqual is deprecated. Use deepStrictEqual instead