Hide disabled workspaces/clusters (#1573)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-12-01 15:27:54 +02:00
1 parent 832f29f666
commit 4161ee832c
7 files changed
+180 -32

No files matched your search

+23 -1
View File
@@ -7,6 +7,20 @@ import { workspaceStore } from "../workspace-store";
const testDataIcon = fs.readFileSync("test-data/cluster-store-migration-icon.png");
jest.mock("electron", () => {
return {
app: {
getVersion: () => "99.99.99",
getPath: () => "tmp",
getLocale: () => "en"
},
ipcMain: {
handle: jest.fn(),
on: jest.fn()
}
};
});
let clusterStore: ClusterStore;
describe("empty config", () => {
@@ -48,6 +62,7 @@ describe("empty config", () => {
expect(storedCluster.id).toBe("foo");
expect(storedCluster.preferences.terminalCWD).toBe("/tmp");
expect(storedCluster.preferences.icon).toBe("data:image/jpeg;base64, iVBORw0KGgoAAAANSUhEUgAAA1wAAAKoCAYAAABjkf5");
expect(storedCluster.enabled).toBe(true);
});
it("adds cluster to default workspace", () => {
@@ -170,7 +185,8 @@ describe("config with existing clusters", () => {
kubeConfig: "foo",
contextName: "foo",
preferences: { terminalCWD: "/foo" },
workspace: "foo"
workspace: "foo",
ownerRef: "foo"
},
]
})
@@ -208,6 +224,12 @@ describe("config with existing clusters", () => {
expect(storedClusters[1].preferences.terminalCWD).toBe("/foo2");
expect(storedClusters[2].id).toBe("cluster3");
});
it("marks owned cluster disabled by default", () => {
const storedClusters = clusterStore.clustersList;
expect(storedClusters[0].enabled).toBe(true);
expect(storedClusters[2].enabled).toBe(false);
});
});
describe("pre 2.0 config with an existing cluster", () => {
+7 -1
View File
@@ -6,6 +6,10 @@ jest.mock("electron", () => {
getVersion: () => "99.99.99",
getPath: () => "tmp",
getLocale: () => "en"
},
ipcMain: {
handle: jest.fn(),
on: jest.fn()
}
};
});
@@ -60,7 +64,9 @@ describe("workspace store tests", () => {
name: "foobar",
}));
expect(ws.getById("123").name).toBe("foobar");
const workspace = ws.getById("123");
expect(workspace.name).toBe("foobar");
expect(workspace.enabled).toBe(true);
});
it("cannot set a non-existent workspace to be active", () => {