The old style of merging all of a function's variable declarations into a single statement made some sense back in the days of var, but there's no reason to keep doing it now that we use const and let.
33 lines
1017 B
JavaScript
33 lines
1017 B
JavaScript
describe('toBeNegativeInfinity', function() {
|
|
it("fails for anything that isn't -Infinity", function() {
|
|
const matcher = privateUnderTest.matchers.toBeNegativeInfinity();
|
|
let result;
|
|
|
|
result = matcher.compare(1);
|
|
expect(result.pass).toBe(false);
|
|
|
|
result = matcher.compare(Number.NaN);
|
|
expect(result.pass).toBe(false);
|
|
|
|
result = matcher.compare(null);
|
|
expect(result.pass).toBe(false);
|
|
});
|
|
|
|
it('has a custom message on failure', function() {
|
|
const matcher = privateUnderTest.matchers.toBeNegativeInfinity({
|
|
pp: privateUnderTest.makePrettyPrinter()
|
|
});
|
|
const result = matcher.compare(0);
|
|
|
|
expect(result.message()).toEqual('Expected 0 to be -Infinity.');
|
|
});
|
|
|
|
it('succeeds for -Infinity', function() {
|
|
const matcher = privateUnderTest.matchers.toBeNegativeInfinity();
|
|
const result = matcher.compare(Number.NEGATIVE_INFINITY);
|
|
|
|
expect(result.pass).toBe(true);
|
|
expect(result.message).toEqual('Expected actual not to be -Infinity.');
|
|
});
|
|
});
|