1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Update tests

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen 2021-10-05 08:59:20 +03:00
parent bbde39e7b9
commit fcdd0323e0
No known key found for this signature in database
GPG Key ID: 54B44603D251B788

View File

@ -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("<Catalog />", () => {
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("<Catalog />", () => {
);
render(
<Catalog history={history} location={mockLocation} match={mockMatch} />
<Catalog
history={history}
location={mockLocation}
match={mockMatch}
catalogEntityStore={catalogEntityStore}
/>
);
userEvent.click(screen.getByTestId("detail-panel-hot-bar-icon"));