diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 1bdf964dd..c4ad63e86 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -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;