Skip to content

Commit b62529d

Browse files
committed
make toBeCloseToArray and toBeCloseToArray2D handle NaN properly
- as `NaN === NaN // => false`
1 parent 8ad7e93 commit b62529d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/jasmine/assets/custom_matchers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ function isClose(actual, expected, precision) {
143143
return Math.abs(actual - expected) < precision;
144144
}
145145

146-
return actual === expected;
146+
return (
147+
actual === expected ||
148+
(isNaN(actual) && isNaN(expected))
149+
);
147150
}
148151

149152
function coercePosition(precision) {

0 commit comments

Comments
 (0)