Add tests for call return value tracking

This commit is contained in:
pimterry
2013-12-07 22:08:10 +00:00
parent 3b52d015ea
commit b1d4ab09af
2 changed files with 21 additions and 2 deletions

View File

@@ -47,6 +47,16 @@ describe('Spies', function () {
expect(trackSpy.calls.mostRecent().args[0].object).toEqual(contextObject);
});
it("tracks the return value of calls", function () {
var spy = j$.createSpy(TestClass.prototype, TestClass.prototype.someFunction);
var trackSpy = spyOn(spy.calls, "track");
spy.and.returnValue("return value");
spy();
expect(trackSpy.calls.mostRecent().args[0].returnValue).toEqual("return value");
});
});
describe("createSpyObj", function() {