mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-28 07:18:03 +00:00
* Introduced tsconfig.app.json and tsconfig.base.json * yarn.lock * Introduced tsconfig.app.json, tsconfig.base.jsonfig. * Refactored eslint.config.js to latest structure * Returned previous recommended rules. * More rules * Force import rules * Check * Check * Cleanup ESLint configuration and plugins * Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration * "scripts" moved to the top of package.json
91 lines
2.5 KiB
TypeScript
91 lines
2.5 KiB
TypeScript
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { BrowserRouter } from "react-router";
|
|
|
|
import { AppContextProvider } from "../context/AppContext";
|
|
import type { Release } from "../data/types";
|
|
|
|
import ClustersList from "./ClustersList";
|
|
import { DeploymentStatus } from "./common/StatusLabel";
|
|
|
|
type ClustersListProps = {
|
|
onClusterChange: (clusterName: string) => void;
|
|
selectedCluster: string;
|
|
filteredNamespaces: string[];
|
|
installedReleases?: Release[];
|
|
};
|
|
|
|
const generateTestReleaseData = (): Release => ({
|
|
id: "id",
|
|
name: "helm-dashboard",
|
|
namespace: "default",
|
|
revision: 1,
|
|
updated: "2024-01-23T15:37:35.0992836+02:00",
|
|
status: DeploymentStatus.DEPLOYED,
|
|
chart: "helm-dashboard-0.1.10",
|
|
chart_name: "helm-dashboard",
|
|
chart_ver: "0.1.10",
|
|
app_version: "1.3.3",
|
|
icon: "https://raw.githubusercontent.com/komodorio/helm-dashboard/main/pkg/dashboard/static/logo.svg",
|
|
description: "A GUI Dashboard for Helm by Komodor",
|
|
has_tests: true,
|
|
chartName: "helm-dashboard",
|
|
chartVersion: "0.1.10",
|
|
});
|
|
|
|
const renderClustersList = (props: ClustersListProps) => {
|
|
const queryClient = new QueryClient();
|
|
cy.mount(
|
|
<AppContextProvider>
|
|
<BrowserRouter>
|
|
<QueryClientProvider client={queryClient}>
|
|
<ClustersList {...props} />
|
|
</QueryClientProvider>
|
|
</BrowserRouter>
|
|
</AppContextProvider>
|
|
);
|
|
};
|
|
|
|
describe("ClustersList", () => {
|
|
it("Got one cluster information", () => {
|
|
cy.intercept("GET", "/api/k8s/contexts", [
|
|
{
|
|
Name: "minikube",
|
|
Namespace: "default",
|
|
IsCurrent: true,
|
|
},
|
|
]).as("getClusters");
|
|
|
|
renderClustersList({
|
|
selectedCluster: "minikube",
|
|
filteredNamespaces: ["default"],
|
|
onClusterChange: () => {},
|
|
installedReleases: [generateTestReleaseData()],
|
|
});
|
|
|
|
cy.wait("@getClusters");
|
|
cy.get(".data-cy-clusterName").contains("minikube");
|
|
cy.get(".data-cy-clusterList-namespace").contains("default");
|
|
cy.get(".data-cy-clustersInput").should("be.checked");
|
|
});
|
|
|
|
it("Dont have a cluster chekced", () => {
|
|
cy.intercept("GET", "/api/k8s/contexts", [
|
|
{
|
|
Name: "minikube",
|
|
Namespace: "default",
|
|
IsCurrent: true,
|
|
},
|
|
]).as("getClusters");
|
|
|
|
renderClustersList({
|
|
selectedCluster: "",
|
|
filteredNamespaces: [""],
|
|
onClusterChange: () => {},
|
|
installedReleases: [generateTestReleaseData()],
|
|
});
|
|
|
|
cy.wait("@getClusters");
|
|
cy.get(".data-cy-clustersInput").should("not.be.checked");
|
|
});
|
|
});
|