fix(test_lib): support multi matches with deep equality for function calls
This commit is contained in:
15
modules/angular2/test/test_lib/test_lib_spec.js
vendored
15
modules/angular2/test/test_lib/test_lib_spec.js
vendored
@ -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});
|
||||
|
||||
|
Reference in New Issue
Block a user