diff --git a/packages/technical-features/application/agnostic/index.ts b/packages/technical-features/application/agnostic/index.ts index 239e938cd2..2e5595a816 100644 --- a/packages/technical-features/application/agnostic/index.ts +++ b/packages/technical-features/application/agnostic/index.ts @@ -5,5 +5,5 @@ export * from "./src/start-application/time-slots"; export type { StartApplication } from "./src/start-application/start-application.injectable"; export { startApplicationInjectionToken } from "./src/start-application/start-application.injectable"; -export { applicationInformationToken } from "./src/application-information-token"; -export type { ApplicationInformation } from "./src/application-information-token"; +export { applicationInformationToken } from "./src/application-information-token.no-coverage"; +export type { ApplicationInformation } from "./src/application-information-token.no-coverage"; diff --git a/packages/technical-features/application/agnostic/src/application-information-token.ts b/packages/technical-features/application/agnostic/src/application-information-token.no-coverage.ts similarity index 100% rename from packages/technical-features/application/agnostic/src/application-information-token.ts rename to packages/technical-features/application/agnostic/src/application-information-token.no-coverage.ts diff --git a/packages/technical-features/application/agnostic/src/start-application/starting-of-application.test.ts b/packages/technical-features/application/agnostic/src/start-application/starting-of-application.test.ts index 69219d4a08..672e3a0f01 100644 --- a/packages/technical-features/application/agnostic/src/start-application/starting-of-application.test.ts +++ b/packages/technical-features/application/agnostic/src/start-application/starting-of-application.test.ts @@ -4,6 +4,7 @@ import { applicationFeature } from "../feature"; import { startApplicationInjectionToken } from "./start-application.injectable"; import * as timeSlots from "./time-slots"; import asyncFn, { AsyncFnMock } from "@async-fn/jest"; +import { getPromiseStatus } from "@k8slens/test-utils"; describe("starting-of-application", () => { let di: DiContainer; @@ -47,10 +48,12 @@ describe("starting-of-application", () => { }); describe("when application is started", () => { + let actualPromise: Promise; + beforeEach(() => { const startApplication = di.inject(startApplicationInjectionToken); - void startApplication(); + actualPromise = startApplication(); }); it("calls runnables registered in before application is loading", () => { @@ -66,10 +69,28 @@ describe("starting-of-application", () => { expect(onLoadOfApplicationMock).toHaveBeenCalled(); }); - it("when runnables in before application is loading resolve, calls runnables registered in after load of application", async () => { - await onLoadOfApplicationMock.resolve(); + describe("when runnables in before application is loading resolve", () => { + beforeEach(async () => { + await onLoadOfApplicationMock.resolve(); + }); - expect(afterApplicationIsLoadedMock).toHaveBeenCalled(); + it("calls runnables registered in after load of application", async () => { + expect(afterApplicationIsLoadedMock).toHaveBeenCalled(); + }); + + it("does not resolve yet", async () => { + const promiseStatus = await getPromiseStatus(actualPromise); + + expect(promiseStatus.fulfilled).toBe(false); + }); + + it("when runnables in after application is loaded resolve, resolves", async () => { + await afterApplicationIsLoadedMock.resolve(); + + const promiseStatus = await getPromiseStatus(actualPromise); + + expect(promiseStatus.fulfilled).toBe(true); + }); }); }); });