Make test more strict

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne SavolainenandMikko Aspiala committed 2022-05-18 10:09:46 +03:00
1 parent df4e65d4b3
commit aa32655cbe
2 files changed
+13 -7

No files matched your search

+7 -4
View File
@@ -17,7 +17,7 @@ import { getPromiseStatus } from "../test-utils/get-promise-status";
describe("runManyFor", () => {
describe("given no hierarchy, when running many", () => {
let runMock: AsyncFnMock<() => Promise<void>>;
let runMock: AsyncFnMock<(...args: unknown[]) => Promise<void>>;
let actualPromise: Promise<void>;
beforeEach(() => {
@@ -31,13 +31,13 @@ describe("runManyFor", () => {
const someInjectable = getInjectable({
id: "some-injectable",
instantiate: () => ({ run: runMock }),
instantiate: () => ({ run: () => runMock("some-call") }),
injectionToken: someInjectionTokenForRunnables,
});
const someOtherInjectable = getInjectable({
id: "some-other-injectable",
instantiate: () => ({ run: runMock }),
instantiate: () => ({ run: () => runMock("some-other-call") }),
injectionToken: someInjectionTokenForRunnables,
});
@@ -49,7 +49,10 @@ describe("runManyFor", () => {
});
it("runs all runnables at the same time", () => {
expect(runMock).toHaveBeenCalledTimes(2);
expect(runMock.mock.calls).toEqual([
["some-call"],
["some-other-call"],
]);
});
it("does not resolve yet", async () => {
@@ -27,13 +27,13 @@ describe("runManySyncFor", () => {
const someInjectable = getInjectable({
id: "some-injectable",
instantiate: () => ({ run: runMock }),
instantiate: () => ({ run: () => runMock("some-call") }),
injectionToken: someInjectionTokenForRunnables,
});
const someOtherInjectable = getInjectable({
id: "some-other-injectable",
instantiate: () => ({ run: runMock }),
instantiate: () => ({ run: () => runMock("some-other-call") }),
injectionToken: someInjectionTokenForRunnables,
});
@@ -45,7 +45,10 @@ describe("runManySyncFor", () => {
});
it("runs all runnables at the same time", () => {
expect(runMock).toHaveBeenCalledTimes(2);
expect(runMock.mock.calls).toEqual([
["some-call"],
["some-other-call"],
]);
});
});