Permalink
Browse files

Added infinity matchers

  • Loading branch information...
thodorisbais committed Mar 19, 2017
1 parent 6c6099b commit bb94648196c68bec55087c4d7f857c13b9435599
Showing with 38 additions and 0 deletions.
  1. +38 −0 lib/jasmine-node/jasmine-1.3.1.js
@@ -22,6 +22,22 @@ jasmine.unimplementedMethod_ = function() {
*/
jasmine.undefined = jasmine.___undefined___;
/**
* Use <code>jasmine.POSITIVE_INFINITY</code> instead of <code>Infinity</code>, since <code>Infinity</code> is just
* a plain old variable and may be redefined by somebody else.
*
* @private
*/
jasmine.POSITIVE_INFINITY = Infinity;
/**
* Use <code>jasmine.NEGATIVE_INFINITY</code> instead of <code>-Infinity</code>, since <code>-Infinity</code> is just
* a plain old variable and may be redefined by somebody else.
*
* @private
*/
jasmine.NEGATIVE_INFINITY = -Infinity;
/**
* Show diagnostic messages in the console if set to true
*
@@ -1414,6 +1430,28 @@ jasmine.Matchers.prototype.toBeNaN = function() {
return (this.actual !== this.actual);
};
/**
* Matcher that compares the actual to Infinity.
*/
jasmine.Matchers.prototype.toBePositiveInfinity = function() {
this.message = function() {
return [ "Expected " + jasmine.pp(this.actual) + " to be Infinity." ];
};
return (this.actual === jasmine.POSITIVE_INFINITY);
};
/**
* Matcher that compares the actual to -Infinity.
*/
jasmine.Matchers.prototype.toBeNegativeInfinity = function() {
this.message = function() {
return [ "Expected " + jasmine.pp(this.actual) + " to be -Infinity." ];
};
return (this.actual === jasmine.NEGATIVE_INFINITY);
};
/**
* Matcher that boolean not-nots the actual.
*/

0 comments on commit bb94648

Please sign in to comment.