Skip to content

Commit

Permalink
function spying tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kwolfy committed Nov 12, 2017
1 parent 2fe1992 commit c1e4cf3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/spy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ describe("spying on a real object", () => {
}
}

function RealFn() {

}

describe("calling a mocked method", () => {
it("delegates a call to the mock", () => {
// given
Expand Down Expand Up @@ -72,6 +76,16 @@ describe("spying on a real object", () => {
});
});

describe("spying functions", () => {
it("should not mock function.prototype methods", () => {
// when
spy(RealFn);

expect(RealFn.bind).toBe(Function.prototype.bind);
expect(RealFn.apply).toBe(Function.prototype.apply);
});
});

describe("access to a real object property", () => {
it("get instance property", () => {
// given
Expand Down

0 comments on commit c1e4cf3

Please sign in to comment.