mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove unnecessary CatalogEntityItem (#4582)
* Remove unnecessary CatalogEntityItem Signed-off-by: Sebastian Malton <sebastian@malton.name> * Using simple notation to set search url params Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Fix styles file name Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
2d279a6b99
commit
8082501bb3
8 files changed
+219
-110
No files matched your search
@@ -20,9 +20,11 @@
|
||||
*/
|
||||
|
||||
import { anyObject } from "jest-mock-extended";
|
||||
import { merge } from "lodash";
|
||||
import mockFs from "mock-fs";
|
||||
import logger from "../../main/logger";
|
||||
import { AppPaths } from "../app-paths";
|
||||
import type { CatalogEntity, CatalogEntityData, CatalogEntityKindData } from "../catalog";
|
||||
import { ClusterStore } from "../cluster-store";
|
||||
import { HotbarStore } from "../hotbar-store";
|
||||
|
||||
@@ -54,68 +56,58 @@ jest.mock("../../main/catalog/catalog-entity-registry", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const testCluster = {
|
||||
uid: "test",
|
||||
name: "test",
|
||||
function getMockCatalogEntity(data: Partial<CatalogEntityData> & CatalogEntityKindData): CatalogEntity {
|
||||
return merge(data, {
|
||||
getName: jest.fn(() => data.metadata?.name),
|
||||
getId: jest.fn(() => data.metadata?.uid),
|
||||
getSource: jest.fn(() => data.metadata?.source ?? "unknown"),
|
||||
isEnabled: jest.fn(() => data.status?.enabled ?? true),
|
||||
onContextMenuOpen: jest.fn(),
|
||||
onSettingsOpen: jest.fn(),
|
||||
metadata: {},
|
||||
spec: {},
|
||||
status: {},
|
||||
}) as CatalogEntity;
|
||||
}
|
||||
|
||||
const testCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
spec: {},
|
||||
getName: jest.fn(),
|
||||
getId: jest.fn(),
|
||||
onDetailsOpen: jest.fn(),
|
||||
onContextMenuOpen: jest.fn(),
|
||||
onSettingsOpen: jest.fn(),
|
||||
metadata: {
|
||||
uid: "test",
|
||||
name: "test",
|
||||
labels: {},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const minikubeCluster = {
|
||||
uid: "minikube",
|
||||
name: "minikube",
|
||||
const minikubeCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
spec: {},
|
||||
getName: jest.fn(),
|
||||
getId: jest.fn(),
|
||||
onDetailsOpen: jest.fn(),
|
||||
onContextMenuOpen: jest.fn(),
|
||||
onSettingsOpen: jest.fn(),
|
||||
metadata: {
|
||||
uid: "minikube",
|
||||
name: "minikube",
|
||||
labels: {},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const awsCluster = {
|
||||
uid: "aws",
|
||||
name: "aws",
|
||||
const awsCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
spec: {},
|
||||
getName: jest.fn(),
|
||||
getId: jest.fn(),
|
||||
onDetailsOpen: jest.fn(),
|
||||
onContextMenuOpen: jest.fn(),
|
||||
onSettingsOpen: jest.fn(),
|
||||
metadata: {
|
||||
uid: "aws",
|
||||
name: "aws",
|
||||
labels: {},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
|
||||
Reference in new issue
Block a user