fix(test_lib): support multi matches with deep equality for function calls

This commit is contained in:
Tobias Bosch
2015-04-23 09:13:42 -07:00
parent 623edcd2d8
commit f78406392b
2 changed files with 44 additions and 0 deletions

View File

@ -10,6 +10,9 @@ class TestObj {
someFunc():number {
return -1;
}
someComplexFunc(a) {
return a;
}
}
@proxy
@ -80,6 +83,18 @@ export function main() {
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1,2);
});
it("should match multiple function calls", () => {
spyObj.someFunc(1,2);
spyObj.someFunc(3,4);
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1,2);
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(3,4);
});
it("should match using deep equality", () => {
spyObj.someComplexFunc([1]);
expect(spyObj.spy("someComplexFunc")).toHaveBeenCalledWith([1]);
});
it("should support stubs", () => {
var s = SpyObject.stub({"a":1}, {"b":2});