You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this production code (a is still a string instead of number and b is correct)
res.status(201).json({a: '1',b: 2});
produces
1 passing (5ms)
In other words, current (incosistent) behavior is:
If all properties are ==, ok!
If they are not ==, compare them using === to show the result
The behavior should be the same in all cases. Presumably, only === should be used for comparison, producing the same result as deepEqual method from should library.
@awvalenti yes that is currently a known limitation. The expect function is checking the response body using assert.deepEqual, which for primitives (of the object) does use ==.
I think the correct answer is to change this line to use .deepStrictEqual instead.
Consider this test:
This production code (both properties incorrect: a is string instead of number and b is 3 instead of 2)
produces the following (correct) test result:
However, this production code (a is still a string instead of number and b is correct)
produces
In other words, current (incosistent) behavior is:
==
, ok!==
, compare them using===
to show the resultThe behavior should be the same in all cases. Presumably, only
===
should be used for comparison, producing the same result asdeepEqual
method fromshould
library.Temporary solution is to do:
The text was updated successfully, but these errors were encountered: