From fcdd0323e0b5527ec35c297615bb79e7292cd7d0 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Tue, 5 Oct 2021 08:59:20 +0300 Subject: [PATCH] Update tests Signed-off-by: Hung-Han (Henry) Chen --- .../components/+catalog/catalog.test.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/+catalog/catalog.test.tsx b/src/renderer/components/+catalog/catalog.test.tsx index 94e6d125af..b10a71d95b 100644 --- a/src/renderer/components/+catalog/catalog.test.tsx +++ b/src/renderer/components/+catalog/catalog.test.tsx @@ -26,8 +26,8 @@ import { Catalog } from "./catalog"; import { createMemoryHistory } from "history"; import { mockWindow } from "../../../../__mocks__/windowMock"; import { kubernetesClusterCategory } from "../../../common/catalog-entities/kubernetes-cluster"; -import { catalogCategoryRegistry } from "../../../common/catalog"; -import { catalogEntityRegistry } from "../../../renderer/api/catalog-entity-registry"; +import { catalogCategoryRegistry, CatalogCategoryRegistry } from "../../../common/catalog"; +import { CatalogEntityRegistry } from "../../../renderer/api/catalog-entity-registry"; import { CatalogEntityDetailRegistry } from "../../../extensions/registries"; import { CatalogEntityItem } from "./catalog-entity-item"; import { CatalogEntityStore } from "./catalog-entity.store"; @@ -120,9 +120,13 @@ describe("", () => { onRun, }); + const catalogCategoryRegistry = new CatalogCategoryRegistry(); + const catalogEntityRegistry = new CatalogEntityRegistry(catalogCategoryRegistry); + const catalogEntityStore = new CatalogEntityStore(catalogEntityRegistry); + // mock as if there is a selected item > the detail panel opens jest - .spyOn(CatalogEntityStore.prototype, "selectedItem", "get") + .spyOn(catalogEntityStore, "selectedItem", "get") .mockImplementation(() => { return catalogEntityItem; }); @@ -170,7 +174,12 @@ describe("", () => { ); render( - + ); userEvent.click(screen.getByTestId("detail-panel-hot-bar-icon"));