Added infinity methods, with tests

This commit is contained in:
Thodoris Bais
2017-03-27 00:04:43 +02:00
parent 7f8f2b5e7a
commit 08f046c24c
5 changed files with 122 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
getJasmineRequireObj().toBeNegativeInfinity = function(j$) {
/**
* {@link expect} the actual value to be `-Infinity` (-infinity).
* @function
* @name matchers#toBeNegativeInfinity
* @example
* expect(thing).toBeNegativeInfinity();
*/
function toBeNegativeInfinity() {
return {
compare: function(actual) {
var result = {
pass: (actual === Number.NEGATIVE_INFINITY)
};
if (result.pass) {
result.message = 'Expected actual to be -Infinity.';
} else {
result.message = function() { return 'Expected ' + j$.pp(actual) + ' not to be -Infinity.'; };
}
return result;
}
};
}
return toBeNegativeInfinity;
};