From fbfdb69318a6d15429a9857c5aeda1a09633104b Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 27 Jun 2022 11:39:46 -0400 Subject: [PATCH] Update tests with more namespaces Signed-off-by: Sebastian Malton --- .../namespace-select-filter.test.tsx.snap | 876 +++++++++++++++++- .../namespace-select-filter.test.tsx | 50 +- 2 files changed, 883 insertions(+), 43 deletions(-) diff --git a/src/renderer/components/+namespaces/__snapshots__/namespace-select-filter.test.tsx.snap b/src/renderer/components/+namespaces/__snapshots__/namespace-select-filter.test.tsx.snap index 17b797c044..8b6d070b2c 100644 --- a/src/renderer/components/+namespaces/__snapshots__/namespace-select-filter.test.tsx.snap +++ b/src/renderer/components/+namespaces/__snapshots__/namespace-select-filter.test.tsx.snap @@ -209,11 +209,11 @@ exports[` when clicked renders 1`] = ` - default + test-1 when clicked renders 1`] = ` - kube-system + test-2 when clicked renders 1`] = ` - kube-system-2 + test-3 + + check + + + + +
+
+ + + layers + + + + test-4 + + + + check + + +
+
+
+
+ + + layers + + + + test-5 + + + + check + + +
+
+
+
+ + + layers + + + + test-6 + + + + check + + +
+
+
+
+ + + layers + + + + test-7 + + + + check + + +
+
+
+
+ + + layers + + + + test-8 + + + + check + + +
+
+
+
+ + + layers + + + + test-9 + + + + check + + +
+
+
+
+ + + layers + + + + test-10 + + + + check + + +
+
+
+
+ + + layers + + + + test-11 + + + + check + + +
+
+
+
+ + + layers + + + + test-12 + + + + check + + +
+
+
+
+ + + layers + + + + test-13 + + when clicked renders 1`] = ` `; -exports[` when clicked when 'kube-system' is clicked renders 1`] = ` +exports[` when clicked when 'test-2' is clicked renders 1`] = `
when clicked when 'kube-system' is clicked re class="Select__placeholder css-14el2xx-placeholder" id="react-select-namespace-select-filter-placeholder" > - Namespace: kube-system + Namespace: test-2
when clicked when 'kube-system' is clicked re `; -exports[` when clicked when 'kube-system' is clicked when clicked again renders 1`] = ` +exports[` when clicked when 'test-2' is clicked when clicked again renders 1`] = `
when clicked when 'kube-system' is clicked wh class="Select__placeholder css-14el2xx-placeholder" id="react-select-namespace-select-filter-placeholder" > - Namespace: kube-system + Namespace: test-2
when clicked when 'kube-system' is clicked wh - kube-system + test-2 when clicked when 'kube-system' is clicked wh - default + test-1
@@ -568,7 +918,247 @@ exports[` when clicked when 'kube-system' is clicked wh - kube-system-2 + test-3 + +
+
+
+
+ + + layers + + + + test-4 + +
+
+
+
+ + + layers + + + + test-5 + +
+
+
+
+ + + layers + + + + test-6 + +
+
+
+
+ + + layers + + + + test-7 + +
+
+
+
+ + + layers + + + + test-8 + +
+
+
+
+ + + layers + + + + test-9 + +
+
+
+
+ + + layers + + + + test-10 + +
+
+
+
+ + + layers + + + + test-11 + +
+
+
+
+ + + layers + + + + test-12 + +
+
+
+
+ + + layers + + + + test-13
@@ -578,7 +1168,7 @@ exports[` when clicked when 'kube-system' is clicked wh `; -exports[` when clicked when 'kube-system' is clicked when clicked again when 'default' is clicked renders 1`] = ` +exports[` when clicked when 'test-2' is clicked when clicked again when 'test-1' is clicked renders 1`] = `
when clicked when 'kube-system' is clicked wh class="Select__placeholder css-14el2xx-placeholder" id="react-select-namespace-select-filter-placeholder" > - Namespace: default + Namespace: test-1
when clicked when 'kube-system' is clicked wh `; -exports[` when clicked when 'kube-system' is clicked when clicked again when 'default' is clicked when clicked again, then holding down multi select key, and then clicking 'kube-system-2' when 'kube-system-2' is clicked renders 1`] = ` +exports[` when clicked when 'test-2' is clicked when clicked again when 'test-1' is clicked when clicked again, then holding down multi select key, and then clicking 'test-3' when 'test-3' is clicked renders 1`] = `
when clicked when 'kube-system' is clicked wh class="Select__placeholder css-14el2xx-placeholder" id="react-select-namespace-select-filter-placeholder" > - Namespaces: default, kube-system-2 + Namespaces: test-1, test-3
when clicked when 'kube-system' is clicked wh - default + test-1 when clicked when 'kube-system' is clicked wh - kube-system + test-2
@@ -846,11 +1436,11 @@ exports[` when clicked when 'kube-system' is clicked wh - kube-system-2 + test-3 when clicked when 'kube-system' is clicked wh
+
+
+ + + layers + + + + test-4 + +
+
+
+
+ + + layers + + + + test-5 + +
+
+
+
+ + + layers + + + + test-6 + +
+
+
+
+ + + layers + + + + test-7 + +
+
+
+
+ + + layers + + + + test-8 + +
+
+
+
+ + + layers + + + + test-9 + +
+
+
+
+ + + layers + + + + test-10 + +
+
+
+
+ + + layers + + + + test-11 + +
+
+
+
+ + + layers + + + + test-12 + +
+
+
+
+ + + layers + + + + test-13 + +
+
diff --git a/src/renderer/components/+namespaces/namespace-select-filter.test.tsx b/src/renderer/components/+namespaces/namespace-select-filter.test.tsx index abc40f62e7..cc0622dcba 100644 --- a/src/renderer/components/+namespaces/namespace-select-filter.test.tsx +++ b/src/renderer/components/+namespaces/namespace-select-filter.test.tsx @@ -43,9 +43,19 @@ describe("", () => { const render = renderFor(di); namespaceStore.items.replace([ - createNamespace("default"), - createNamespace("kube-system"), - createNamespace("kube-system-2"), + createNamespace("test-1"), + createNamespace("test-2"), + createNamespace("test-3"), + createNamespace("test-4"), + createNamespace("test-5"), + createNamespace("test-6"), + createNamespace("test-7"), + createNamespace("test-8"), + createNamespace("test-9"), + createNamespace("test-10"), + createNamespace("test-11"), + createNamespace("test-12"), + createNamespace("test-13"), ]); result = render(( @@ -70,17 +80,17 @@ describe("", () => { expect(result.baseElement.querySelector("#react-select-namespace-select-filter-listbox")).not.toBeNull(); }); - describe("when 'kube-system' is clicked", () => { + describe("when 'test-2' is clicked", () => { beforeEach(() => { - result.getByText("kube-system").click(); + result.getByText("test-2").click(); }); it("renders", () => { expect(result.baseElement).toMatchSnapshot(); }); - it("has only 'kube-system' is selected in the store", () => { - expect(namespaceStore.contextNamespaces).toEqual(["kube-system"]); + it("has only 'test-2' is selected in the store", () => { + expect(namespaceStore.contextNamespaces).toEqual(["test-2"]); }); it("closes menu", () => { @@ -96,32 +106,32 @@ describe("", () => { expect(result.baseElement).toMatchSnapshot(); }); - it("shows 'kube-system' as selected", () => { - expect(result.queryByTestId("namespace-select-filter-option-kube-system-selected")).not.toBeNull(); + it("shows 'test-2' as selected", () => { + expect(result.queryByTestId("namespace-select-filter-option-test-2-selected")).not.toBeNull(); }); - it("does not show 'default' as selected", () => { - expect(result.queryByTestId("namespace-select-filter-option-default-selected")).toBeNull(); + it("does not show 'test-1' as selected", () => { + expect(result.queryByTestId("namespace-select-filter-option-test-1-selected")).toBeNull(); }); - describe("when 'default' is clicked", () => { + describe("when 'test-1' is clicked", () => { beforeEach(() => { - result.getByText("default").click(); + result.getByText("test-1").click(); }); it("renders", () => { expect(result.baseElement).toMatchSnapshot(); }); - it("has only 'default' is selected in the store", () => { - expect(namespaceStore.contextNamespaces).toEqual(["default"]); + it("has only 'test-1' is selected in the store", () => { + expect(namespaceStore.contextNamespaces).toEqual(["test-1"]); }); it("closes menu", () => { expect(result.baseElement.querySelector("#react-select-namespace-select-filter-listbox")).toBeNull(); }); - describe("when clicked again, then holding down multi select key, and then clicking 'kube-system-2'", () => { + describe("when clicked again, then holding down multi select key, and then clicking 'test-3'", () => { beforeEach(() => { const filter = result.getByTestId("namespace-select-filter"); @@ -129,17 +139,17 @@ describe("", () => { fireEvent.keyDown(filter, { key: "Meta" }); }); - describe("when 'kube-system-2' is clicked", () => { + describe("when 'test-3' is clicked", () => { beforeEach(() => { - result.getByText("kube-system-2").click(); + result.getByText("test-3").click(); }); it("renders", () => { expect(result.baseElement).toMatchSnapshot(); }); - it("has both 'default' and 'kube-system-2' as selected in the store", () => { - expect(new Set(namespaceStore.contextNamespaces)).toEqual(new Set(["default", "kube-system-2"])); + it("has both 'test-1' and 'test-3' as selected in the store", () => { + expect(new Set(namespaceStore.contextNamespaces)).toEqual(new Set(["test-1", "test-3"])); }); it("keeps menu open", () => {