Browse Source

Fix mock not calling its lifetime function

master 1.2.2
Michaël Lemaire 8 months ago
parent
commit
ef427120ff
  1. 5
      testing.test.ts
  2. 2
      testing.ts

5
testing.test.ts

@ -136,6 +136,11 @@ describe(mock, () => {
});
checkRestored(o);
const f = mock(o, "func", undefined, () => o.func(2));
expect(f).toHaveBeenCalledTimes(1);
checkRestored(o);
});
it("stubs with a fixed value", () => {

2
testing.ts

@ -116,6 +116,6 @@ export function mock<
typeof stub == "function" ? stub as any : (() => stub) as F,
true,
);
lifetime;
lifetime(mock as any);
}) as unknown as F;
}
Loading…
Cancel
Save