Add context menu entry for deleting local clusters (#2923)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-06-17 12:19:22 -04:00
1 parent e47d26e1ce
commit eb45f45a7a
30 files changed
+348 -377

No files matched your search

+18 -33
View File
@@ -125,33 +125,28 @@ describe("empty config", () => {
expect(storedCluster.preferences.terminalCWD).toBe("/tmp");
expect(storedCluster.preferences.icon).toBe("data:image/jpeg;base64, iVBORw0KGgoAAAANSUhEUgAAA1wAAAKoCAYAAABjkf5");
});
it("removes cluster from store", async () => {
await ClusterStore.getInstance().removeById("foo");
expect(ClusterStore.getInstance().getById("foo")).toBeNull();
});
});
describe("with prod and dev clusters added", () => {
beforeEach(() => {
ClusterStore.getInstance().addClusters(
new Cluster({
id: "prod",
contextName: "foo",
preferences: {
clusterName: "prod"
},
kubeConfigPath: embed("prod", kubeconfig)
}),
new Cluster({
id: "dev",
contextName: "foo2",
preferences: {
clusterName: "dev"
},
kubeConfigPath: embed("dev", kubeconfig)
})
);
const store = ClusterStore.getInstance();
store.addCluster({
id: "prod",
contextName: "foo",
preferences: {
clusterName: "prod"
},
kubeConfigPath: embed("prod", kubeconfig)
});
store.addCluster({
id: "dev",
contextName: "foo2",
preferences: {
clusterName: "dev"
},
kubeConfigPath: embed("dev", kubeconfig)
});
});
it("check if store can contain multiple clusters", () => {
@@ -222,16 +217,6 @@ describe("config with existing clusters", () => {
expect(storedCluster.preferences.terminalCWD).toBe("/foo");
});
it("allows to delete a cluster", () => {
ClusterStore.getInstance().removeById("cluster2");
const storedCluster = ClusterStore.getInstance().getById("cluster1");
expect(storedCluster).toBeTruthy();
const storedCluster2 = ClusterStore.getInstance().getById("cluster2");
expect(storedCluster2).toBeNull();
});
it("allows getting all of the clusters", async () => {
const storedClusters = ClusterStore.getInstance().clustersList;