Skip to content

Commit

Permalink
Added spec for case when last function has been called but method was…
Browse files Browse the repository at this point in the history
… not called at all
  • Loading branch information
maciej.kuster authored and NagRock committed Jul 1, 2021
1 parent c88d093 commit d493961
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/capturing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ describe("capturing method arguments", () => {
foo = instance(mockedFoo);
});

describe("when method has NOT been called", () => {
it("should NOT try to read call with negative index", () => {
// given
let error;

// then
try {
capture(mockedFoo.concatStringWithNumber).last();
} catch (e) {
error = e;
}
expect(error.message).toEqual('Cannot capture arguments, method has not been called so many times: 0');
});
});

describe("when method has been called", () => {
it("captures all arguments passed to it", () => {
// given
Expand Down

0 comments on commit d493961

Please sign in to comment.