Added arrayContaining test

This commit is contained in:
robertjmason
2015-06-30 13:09:48 -07:00
parent 09469cae6f
commit 7b129ea9d4
+24
View File
@@ -657,6 +657,30 @@ describe("jasmine.objectContaining", function () {
});
});
describe("jasmine.arrayContaining", function() {
var foo;
beforeEach(function() {
foo = [1, 2, 3, 4];
});
it("matches arrays with some of the values", function() {
expect(foo).toEqual(jasmine.arrayContaining([3, 1]));
expect(foo).not.toEqual(jasmine.arrayContaining([6]));
});
describe("when used with a spy", function() {
it("is useful when comparing arguments", function() {
var callback = jasmine.createSpy('callback');
callback([1, 2, 3, 4]);
expect(callback).toHaveBeenCalledWith(jasmine.arrayContaining([4, 2, 3]));
expect(callback).not.toHaveBeenCalledWith(jasmine.arrayContaining([5, 2]));
});
});
});
describe("Manually ticking the Jasmine Clock", function () {
var timerCallback: any;