Run Prettier on all files
This commit is contained in:
@@ -1,35 +1,37 @@
|
||||
describe("ArrayWithExactContents", function() {
|
||||
it("matches an array with the same items in a different order", function() {
|
||||
describe('ArrayWithExactContents', function() {
|
||||
it('matches an array with the same items in a different order', function() {
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents(['a', 2, /a/]);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
expect(matcher.asymmetricMatch([2, 'a', /a/], matchersUtil)).toBe(true);
|
||||
});
|
||||
|
||||
it("does not work when not passed an array", function() {
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents("foo");
|
||||
it('does not work when not passed an array', function() {
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents('foo');
|
||||
|
||||
expect(function() {
|
||||
matcher.asymmetricMatch([]);
|
||||
}).toThrowError(/not 'foo'/);
|
||||
});
|
||||
|
||||
it("does not match when an item is missing", function() {
|
||||
it('does not match when an item is missing', function() {
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents(['a', 2, /a/]);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
expect(matcher.asymmetricMatch(['a', 2], matchersUtil)).toBe(false);
|
||||
expect(matcher.asymmetricMatch(['a', 2, undefined], matchersUtil)).toBe(false);
|
||||
expect(matcher.asymmetricMatch(['a', 2, undefined], matchersUtil)).toBe(
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it("does not match when there is an extra item", function() {
|
||||
it('does not match when there is an extra item', function() {
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents(['a']);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil();
|
||||
|
||||
expect(matcher.asymmetricMatch(['a', 2], matchersUtil)).toBe(false);
|
||||
});
|
||||
|
||||
it("jasmineToStrings itself", function() {
|
||||
it('jasmineToStrings itself', function() {
|
||||
var sample = [],
|
||||
matcher = new jasmineUnderTest.ArrayWithExactContents(sample),
|
||||
pp = jasmine.createSpy('pp').and.returnValue('sample');
|
||||
@@ -40,17 +42,23 @@ describe("ArrayWithExactContents", function() {
|
||||
expect(pp).toHaveBeenCalledWith(sample);
|
||||
});
|
||||
|
||||
it("uses custom equality testers", function() {
|
||||
it('uses custom equality testers', function() {
|
||||
var tester = function(a, b) {
|
||||
// All "foo*" strings match each other.
|
||||
if (typeof a == "string" && typeof b == "string" &&
|
||||
a.substr(0, 3) == "foo" && b.substr(0, 3) == "foo") {
|
||||
if (
|
||||
typeof a == 'string' &&
|
||||
typeof b == 'string' &&
|
||||
a.substr(0, 3) == 'foo' &&
|
||||
b.substr(0, 3) == 'foo'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents(["fooVal"]);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil({customTesters: [tester]});
|
||||
var matcher = new jasmineUnderTest.ArrayWithExactContents(['fooVal']);
|
||||
var matchersUtil = new jasmineUnderTest.MatchersUtil({
|
||||
customTesters: [tester]
|
||||
});
|
||||
|
||||
expect(matcher.asymmetricMatch(["fooBar"], matchersUtil)).toBe(true);
|
||||
expect(matcher.asymmetricMatch(['fooBar'], matchersUtil)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user