diff --git a/packages/core/src/features/custom-resources/view-with-extra-columns.test.ts b/packages/core/src/features/custom-resources/view-with-extra-columns.test.ts index 98e65bbdaa..cde4b1c179 100644 --- a/packages/core/src/features/custom-resources/view-with-extra-columns.test.ts +++ b/packages/core/src/features/custom-resources/view-with-extra-columns.test.ts @@ -23,9 +23,10 @@ describe("Viewing Custom Resources with extra columns", () => { beforeEach(async () => { builder = getApplicationBuilder(); - builder.setEnvironmentToClusterFrame(); - builder.afterWindowStart(({ windowDi }) => { + await builder.setEnvironmentToClusterFrame(); + + await builder.afterWindowStart(({ windowDi }) => { const apiManager = windowDi.inject(apiManagerInjectable); customResourceDefinitionStore = windowDi.inject(customResourceDefinitionStoreInjectable); diff --git a/packages/core/src/features/hotbar/storage/main/welcome-page-migration.test.ts b/packages/core/src/features/hotbar/storage/main/welcome-page-migration.test.ts index d9804dbc22..958b70d08d 100644 --- a/packages/core/src/features/hotbar/storage/main/welcome-page-migration.test.ts +++ b/packages/core/src/features/hotbar/storage/main/welcome-page-migration.test.ts @@ -47,7 +47,7 @@ describe("hotbar-welcome-page-migration", () => { let migration: MigrationDeclaration; let store: MigrationStore; - const storeModel = new Map(); + const storeModel = new Map(); beforeEach(() => { migration = di.inject(v640HotbarStoreMigrationInjectable); @@ -63,25 +63,29 @@ describe("hotbar-welcome-page-migration", () => { storeModel.set("hotbars", [emptyHotbar]); store = { path: "some-path", - get: (key: string) => storeModel.get(key), - set: (key: string, value: any) => storeModel.set(key, value), - delete: (key: string) => storeModel.delete(key), - has: (key: string) => storeModel.has(key), + get: (key) => storeModel.get(key), + set: (key, value) => storeModel.set(key, value), + delete: (key) => storeModel.delete(key), + has: (key) => storeModel.has(key), clear: () => storeModel.clear(), - }; + } as MigrationStore; }); it("given first hotbar is empty, adds welcome page to first place", () => { migration.run(store); - expect(storeModel.get("hotbars")[0].items[0]).toEqual(welcomeHotbarItem); + + const hotbars = storeModel.get("hotbars") as HotbarData[]; + + expect(hotbars[0]?.items[0]).toEqual(welcomeHotbarItem); }); it("given first hotbar has items but is not full, adds welcome page to first place", () => { setFirstHotbarItems(store, [someItem]); migration.run(store); + const hotbars = storeModel.get("hotbars") as HotbarData[]; - expect(storeModel.get("hotbars")[0].items.slice(0, 2)).toEqual([welcomeHotbarItem, someItem]); + expect(hotbars[0]?.items.slice(0, 2)).toEqual([welcomeHotbarItem, someItem]); }); it("given first hotbar is full, does not add welcome page", () => { @@ -90,9 +94,10 @@ describe("hotbar-welcome-page-migration", () => { setFirstHotbarItems(store, fullHotbarItems); migration.run(store); + const hotbars = storeModel.get("hotbars") as HotbarData[]; - expect(storeModel.get("hotbars")[0].items).toEqual(fullHotbarItems); - expect(storeModel.get("hotbars")[0].items).not.toContain(welcomeHotbarItem); + expect(hotbars[0]?.items).toEqual(fullHotbarItems); + expect(hotbars[0]?.items).not.toContain(welcomeHotbarItem); }); it("given first hotbar has already welcome page, does not add welcome page", () => { @@ -100,6 +105,9 @@ describe("hotbar-welcome-page-migration", () => { setFirstHotbarItems(store, hotBarItemsWithWelcomePage); migration.run(store); - expect(storeModel.get("hotbars")[0].items).toEqual(hotBarItemsWithWelcomePage); + + const hotbars = storeModel.get("hotbars") as HotbarData[]; + + expect(hotbars[0]?.items).toEqual(hotBarItemsWithWelcomePage); }); }); diff --git a/packages/core/src/renderer/components/hotbar/hotbar-selector.tsx b/packages/core/src/renderer/components/hotbar/hotbar-selector.tsx index f1666e6eba..98f55378a7 100644 --- a/packages/core/src/renderer/components/hotbar/hotbar-selector.tsx +++ b/packages/core/src/renderer/components/hotbar/hotbar-selector.tsx @@ -83,13 +83,13 @@ const NonInjectedHotbarSelector = observer(({ className={styles.Badge} onMouseEnter={onMouseEvent} onMouseLeave={onMouseEvent} - data-testid={`hotbar-menu-badge-for-${hotbar?.name.get()}`} + data-testid={hotbar ? `hotbar-menu-badge-for-${hotbar.name.get()}` : undefined} /> {hotbar?.name.get()}