Renamed jasmine.exactly to jasmine.is, for similarity with toBe

This commit is contained in:
Steve Gravrock
2022-05-21 08:30:53 -07:00
parent 856a040a2d
commit 41f7fabe2f
6 changed files with 39 additions and 39 deletions

View File

@@ -72,8 +72,8 @@ describe('Suite', function() {
suite.beforeAll(innerBefore);
expect(suite.beforeAllFns).toEqual([
{ fn: outerBefore.fn, type: 'beforeAll', suite: jasmine.exactly(suite) },
{ fn: innerBefore.fn, type: 'beforeAll', suite: jasmine.exactly(suite) }
{ fn: outerBefore.fn, type: 'beforeAll', suite: jasmine.is(suite) },
{ fn: innerBefore.fn, type: 'beforeAll', suite: jasmine.is(suite) }
]);
});

View File

@@ -1,30 +1,30 @@
describe('Exactly', function() {
describe('Is', function() {
it('passes for primitives that are ===', function() {
const exactly = new jasmineUnderTest.Exactly(17);
const exactly = new jasmineUnderTest.Is(17);
expect(exactly.asymmetricMatch(17)).toBeTrue();
});
it('fails for primitives that are not ===', function() {
const exactly = new jasmineUnderTest.Exactly(42);
const exactly = new jasmineUnderTest.Is(42);
expect(exactly.asymmetricMatch('42')).toBeFalse();
});
it('passes for the same object instance', function() {
const obj = {};
const exactly = new jasmineUnderTest.Exactly(obj);
const exactly = new jasmineUnderTest.Is(obj);
expect(exactly.asymmetricMatch(obj)).toBeTrue();
});
it('fails for different object instances, even if they are deep value equal', function() {
const exactly = new jasmineUnderTest.Exactly({});
const exactly = new jasmineUnderTest.Is({});
expect(exactly.asymmetricMatch({})).toBeFalse();
});
it('describes itself for use in diffs and pretty printing', function() {
const exactly = new jasmineUnderTest.Exactly({ foo: ['bar'] });
const exactly = new jasmineUnderTest.Is({ foo: ['bar'] });
const pp = jasmineUnderTest.basicPrettyPrinter_;
expect(exactly.jasmineToString(pp)).toEqual(
"<jasmine.exactly(Object({ foo: [ 'bar' ] }))>"
"<jasmine.is(Object({ foo: [ 'bar' ] }))>"
);
});
});