Files
jasmine/spec/core/matchers/toBePositiveInfinitySpec.js
2025-09-27 13:21:09 -07:00

33 lines
1009 B
JavaScript

describe('toBePositiveInfinity', function() {
it("fails for anything that isn't Infinity", function() {
const matcher = privateUnderTest.matchers.toBePositiveInfinity();
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.toBePositiveInfinity({
pp: privateUnderTest.makePrettyPrinter()
}),
result = matcher.compare(0);
expect(result.message()).toEqual('Expected 0 to be Infinity.');
});
it('succeeds for Infinity', function() {
const matcher = privateUnderTest.matchers.toBePositiveInfinity(),
result = matcher.compare(Number.POSITIVE_INFINITY);
expect(result.pass).toBe(true);
expect(result.message).toEqual('Expected actual not to be Infinity.');
});
});