Use default failure message for toBeNaN
It is providing the same functionality by default without a custom error message
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
describe("toBeNaN", function() {
|
||||
it("passes for NaN with a custom .not fail", function() {
|
||||
it("passes for NaN", function() {
|
||||
var matcher = j$.matchers.toBeNaN(),
|
||||
result;
|
||||
|
||||
result = matcher.compare(Number.NaN);
|
||||
expect(result.pass).toBe(true);
|
||||
expect(result.message).toEqual("Expected actual not to be NaN.");
|
||||
});
|
||||
|
||||
it("fails for anything not a NaN", function() {
|
||||
@@ -27,11 +26,4 @@ describe("toBeNaN", function() {
|
||||
result = matcher.compare(Number.POSITIVE_INFINITY);
|
||||
expect(result.pass).toBe(false);
|
||||
});
|
||||
|
||||
it("has a custom message on failure", function() {
|
||||
var matcher = j$.matchers.toBeNaN(),
|
||||
result = matcher.compare(0);
|
||||
|
||||
expect(result.message).toEqual("Expected 0 to be NaN.");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,12 +7,6 @@ getJasmineRequireObj().toBeNaN = function(j$) {
|
||||
pass: (actual !== actual)
|
||||
};
|
||||
|
||||
if (result.pass) {
|
||||
result.message = "Expected actual not to be NaN.";
|
||||
} else {
|
||||
result.message = "Expected " + j$.pp(actual) + " to be NaN.";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user