Files
jasmine/spec/core/matchers/toContainSpec.js
Steve Gravrock 434575f49d Use one declaration per statement
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.
2026-03-11 06:30:46 -07:00

26 lines
862 B
JavaScript

describe('toContain', function() {
it('delegates to privateUnderTest.MatchersUtil.contains', function() {
const matchersUtil = {
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
};
const matcher = privateUnderTest.matchers.toContain(matchersUtil);
const result = matcher.compare('ABC', 'B');
expect(matchersUtil.contains).toHaveBeenCalledWith('ABC', 'B');
expect(result.pass).toBe(true);
});
it('works with custom equality testers', function() {
const tester = function(a, b) {
return a.toString() === b.toString();
};
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester]
});
const matcher = privateUnderTest.matchers.toContain(matchersUtil);
const result = matcher.compare(['1', '2'], 2);
expect(result.pass).toBe(true);
});
});