Files
jasmine/src/core/matchers/toBeNaN.js
Steve Gravrock 1f23f1e4d2 Inject a per-runable pretty printer into MatchersUtil
This will allow us to add support for custom object formatters, which
will be a per-runable resource like custom matchers, by injecting them
into the pretty-printer.
2020-02-10 17:26:00 -08:00

30 lines
668 B
JavaScript

getJasmineRequireObj().toBeNaN = function(j$) {
/**
* {@link expect} the actual value to be `NaN` (Not a Number).
* @function
* @name matchers#toBeNaN
* @since 1.3.0
* @example
* expect(thing).toBeNaN();
*/
function toBeNaN(matchersUtil) {
return {
compare: function(actual) {
var result = {
pass: (actual !== actual)
};
if (result.pass) {
result.message = 'Expected actual not to be NaN.';
} else {
result.message = function() { return 'Expected ' + matchersUtil.pp(actual) + ' to be NaN.'; };
}
return result;
}
};
}
return toBeNaN;
};