`;
-exports[`installing helm chart from new tab given tab for installing chart was not previously opened and application is started, when navigating to helm charts when selecting to install the chart when default configuration and versions resolve when cancelled renders 1`] = `
+exports[`installing helm chart from new tab given tab for installing chart was not previously opened and application is started when navigating to helm charts when selecting to install the chart when default configuration and versions resolve when cancelled renders 1`] = `
{
});
});
- describe("given tab for installing chart was not previously opened and application is started, when navigating to helm charts", () => {
+ describe("given tab for installing chart was not previously opened and application is started", () => {
let rendered: RenderResult;
let windowDi: DiContainer;
@@ -114,11 +114,6 @@ describe("installing helm chart from new tab", () => {
windowDi = builder.applicationWindow.only.di;
- builder.helmCharts.navigate({
- chartName: "some-name",
- repo: "some-repository",
- });
-
const writeJsonFile = windowDi.inject(writeJsonFileInjectable);
await writeJsonFile(
@@ -137,364 +132,165 @@ describe("installing helm chart from new tab", () => {
// TODO: Make TerminalWindow unit testable to allow realistic behaviour
dockStore.closeTab("terminal");
- await callForHelmChartsMock.resolve([
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-name",
- version: "some-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
-
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-other-name",
- version: "some-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
- ]);
-
- await callForHelmChartVersionsMock.resolve([
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-name",
- version: "some-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
-
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-name",
- version: "some-other-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
- ]);
-
- await callForHelmChartReadmeMock.resolve("some-readme");
});
- fit("renders", () => {
+ it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- describe("when selecting to install the chart", () => {
- beforeEach(() => {
- callForHelmChartVersionsMock.mockClear();
+ describe("when navigating to helm charts", () => {
- const installButton = rendered.getByTestId(
- "install-chart-for-some-repository-some-name",
- );
+ beforeEach(async () => {
+ builder.helmCharts.navigate({
+ chartName: "some-name",
+ repo: "some-repository",
+ });
- fireEvent.click(installButton);
+ await callForHelmChartsMock.resolve([
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-name",
+ version: "some-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-other-name",
+ version: "some-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+ ]);
+
+ await callForHelmChartVersionsMock.resolve([
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-name",
+ version: "some-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-name",
+ version: "some-other-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+ ]);
+
+ await callForHelmChartReadmeMock.resolve("some-readme");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("shows dock tab for installing the chart", () => {
- expect(
- rendered.getByTestId("dock-tab-content-for-some-first-tab-id"),
- ).toBeInTheDocument();
- });
+ describe("when selecting to install the chart", () => {
+ beforeEach(() => {
+ callForHelmChartVersionsMock.mockClear();
- it("calls for default configuration of the chart", () => {
- expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
- "some-repository",
- "some-name",
- "some-version",
- );
- });
-
- it("calls for available versions", () => {
- expect(callForHelmChartVersionsMock).toHaveBeenCalledWith(
- "some-repository",
- "some-name",
- );
- });
-
- it("shows spinner in dock tab", () => {
- expect(
- rendered.getByTestId("install-chart-tab-spinner"),
- ).toBeInTheDocument();
- });
-
- it("given default configuration resolves but versions have not resolved yet, still shows the spinner", async () => {
- await callForHelmChartValuesMock.resolve(
- "some-default-configuration",
- );
-
- expect(
- rendered.getByTestId("install-chart-tab-spinner"),
- ).toBeInTheDocument();
- });
-
- it("given versions resolve but default configuration has not resolved yet, still shows the spinner", async () => {
- await callForHelmChartVersionsMock.resolve([]);
-
- expect(
- rendered.getByTestId("install-chart-tab-spinner"),
- ).toBeInTheDocument();
- });
-
- describe("when default configuration and versions resolve", () => {
- beforeEach(async () => {
- await callForHelmChartValuesMock.resolve(
- "some-default-configuration",
+ const installButton = rendered.getByTestId(
+ "install-chart-for-some-repository-some-name",
);
- await callForHelmChartVersionsMock.resolve([
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-name",
- version: "some-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
-
- HelmChart.create({
- apiVersion: "some-api-version",
- name: "some-name",
- version: "some-other-version",
- repo: "some-repository",
- created: "2015-10-21T07:28:00Z",
- description: "some-description",
- keywords: [],
- sources: [],
- urls: [],
- annotations: {},
- dependencies: [],
- maintainers: [],
- deprecated: false,
- }),
- ]);
+ fireEvent.click(installButton);
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("does not show spinner anymore", () => {
+ it("shows dock tab for installing the chart", () => {
expect(
- rendered.queryByTestId("install-chart-tab-spinner"),
- ).not.toBeInTheDocument();
+ rendered.getByTestId("dock-tab-content-for-some-first-tab-id"),
+ ).toBeInTheDocument();
});
- describe("when cancelled", () => {
- beforeEach(() => {
- const cancelButton = rendered.getByTestId(
- "cancel-install-chart-from-tab-for-some-first-tab-id",
- );
-
- fireEvent.click(cancelButton);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("closes the tab", () => {
- expect(
- rendered.queryByTestId("dock-tab-for-some-first-tab-id"),
- ).not.toBeInTheDocument();
- });
+ it("calls for default configuration of the chart", () => {
+ expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
+ "some-repository",
+ "some-name",
+ "some-version",
+ );
});
- describe("given no changes in configuration, when installing the chart", () => {
- let installButton: HTMLButtonElement;
-
- beforeEach(() => {
- installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
- ) as HTMLButtonElement;
-
- fireEvent.click(installButton);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("shows spinner in dock tab", () => {
- expect(
- rendered.getByTestId(
- "installing-chart-from-tab-some-first-tab-id",
- ),
- ).toBeInTheDocument();
- });
-
- it("install button is disabled", () => {
- expect(installButton).toHaveAttribute("disabled");
- });
-
- it("calls for installation with default configuration", () => {
- expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
- chart: "some-name",
- name: undefined,
- namespace: "default",
- repo: "some-repository",
- values: "some-default-configuration",
- version: "some-version",
- });
- });
-
- describe("when installation resolves", () => {
- beforeEach(async () => {
- await callForCreateHelmReleaseMock.resolve({
- log: "some-execution-output",
-
- release: {
- resources: [],
- name: "some-release",
- namespace: "default",
- version: "some-version",
- config: "some-config",
- manifest: "some-manifest",
-
- info: {
- deleted: "some-deleted",
- description: "some-description",
- first_deployed: "some-first-deployed",
- last_deployed: "some-last-deployed",
- notes: "some-notes",
- status: "some-status",
- },
- },
- });
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("does not show spinner anymore", () => {
- expect(
- rendered.queryByTestId(
- "installing-chart-from-tab-some-first-tab-id",
- ),
- ).not.toBeInTheDocument();
- });
-
- describe("when selected to see the installed release", () => {
- beforeEach(() => {
- const releaseButton = rendered.getByTestId(
- "show-release-some-release-for-some-first-tab-id",
- );
-
- fireEvent.click(releaseButton);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("shows the details of installed release", () => {
- const currentPath = windowDi
- .inject(currentPathInjectable)
- .get();
-
- expect(currentPath).toBe(
- "/helm/releases/default/some-release",
- );
- });
-
- it("closes the dock tab", () => {
- expect(
- rendered.queryByTestId(
- "dock-tab-for-some-first-tab-id",
- ),
- ).not.toBeInTheDocument();
- });
- });
-
- describe("when selected to show execution output", () => {
- beforeEach(() => {
- const showNotesButton = rendered.getByTestId(
- "show-execution-output-for-some-release-in-some-first-tab-id",
- );
-
- fireEvent.click(showNotesButton);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("shows the execution output", () => {
- expect(
- rendered.getByTestId(
- "logs-dialog-for-helm-chart-install",
- ),
- ).toHaveTextContent("some-execution-output");
- });
-
- it("does not close the dock tab", () => {
- expect(
- rendered.getByTestId("dock-tab-for-some-first-tab-id"),
- ).toBeInTheDocument();
- });
- });
- });
+ it("calls for available versions", () => {
+ expect(callForHelmChartVersionsMock).toHaveBeenCalledWith(
+ "some-repository",
+ "some-name",
+ );
});
- describe("given opening details for second chart, when details resolve", () => {
+ it("shows spinner in dock tab", () => {
+ expect(
+ rendered.getByTestId("install-chart-tab-spinner"),
+ ).toBeInTheDocument();
+ });
+
+ it("given default configuration resolves but versions have not resolved yet, still shows the spinner", async () => {
+ await callForHelmChartValuesMock.resolve(
+ "some-default-configuration",
+ );
+
+ expect(
+ rendered.getByTestId("install-chart-tab-spinner"),
+ ).toBeInTheDocument();
+ });
+
+ it("given versions resolve but default configuration has not resolved yet, still shows the spinner", async () => {
+ await callForHelmChartVersionsMock.resolve([]);
+
+ expect(
+ rendered.getByTestId("install-chart-tab-spinner"),
+ ).toBeInTheDocument();
+ });
+
+ describe("when default configuration and versions resolve", () => {
beforeEach(async () => {
- callForHelmChartReadmeMock.mockClear();
- callForHelmChartVersionsMock.mockClear();
-
- const row = rendered.getByTestId(
- "helm-chart-row-for-some-repository-some-other-name",
+ await callForHelmChartValuesMock.resolve(
+ "some-default-configuration",
);
- fireEvent.click(row);
-
await callForHelmChartVersionsMock.resolve([
HelmChart.create({
apiVersion: "some-api-version",
- name: "some-other-name",
+ name: "some-name",
version: "some-version",
repo: "some-repository",
created: "2015-10-21T07:28:00Z",
@@ -507,23 +303,63 @@ describe("installing helm chart from new tab", () => {
maintainers: [],
deprecated: false,
}),
- ]);
- await callForHelmChartReadmeMock.resolve("some-readme");
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-name",
+ version: "some-other-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+ ]);
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- describe("when selecting to install second chart", () => {
- beforeEach(() => {
- callForHelmChartVersionsMock.mockClear();
+ it("does not show spinner anymore", () => {
+ expect(
+ rendered.queryByTestId("install-chart-tab-spinner"),
+ ).not.toBeInTheDocument();
+ });
- const installButton = rendered.getByTestId(
- "install-chart-for-some-repository-some-other-name",
+ describe("when cancelled", () => {
+ beforeEach(() => {
+ const cancelButton = rendered.getByTestId(
+ "cancel-install-chart-from-tab-for-some-first-tab-id",
);
+ fireEvent.click(cancelButton);
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("closes the tab", () => {
+ expect(
+ rendered.queryByTestId("dock-tab-for-some-first-tab-id"),
+ ).not.toBeInTheDocument();
+ });
+ });
+
+ describe("given no changes in configuration, when installing the chart", () => {
+ let installButton: HTMLButtonElement;
+
+ beforeEach(() => {
+ installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ ) as HTMLButtonElement;
+
fireEvent.click(installButton);
});
@@ -531,48 +367,52 @@ describe("installing helm chart from new tab", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("shows dock tab for installing second chart", () => {
+ it("shows spinner in dock tab", () => {
expect(
rendered.getByTestId(
- "dock-tab-content-for-some-second-tab-id",
+ "installing-chart-from-tab-some-first-tab-id",
),
).toBeInTheDocument();
});
- it("still has the dock tab for installing first chart", () => {
- expect(
- rendered.getByTestId("dock-tab-for-some-first-tab-id"),
- ).toBeInTheDocument();
+ it("install button is disabled", () => {
+ expect(installButton).toHaveAttribute("disabled");
});
- it("calls for default configuration of the second chart", () => {
- expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
- "some-repository",
- "some-other-name",
- "some-version",
- );
+ it("calls for installation with default configuration", () => {
+ expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
+ chart: "some-name",
+ name: undefined,
+ namespace: "default",
+ repo: "some-repository",
+ values: "some-default-configuration",
+ version: "some-version",
+ });
});
- it("calls for available versions for the second chart", () => {
- expect(callForHelmChartVersionsMock).toHaveBeenCalledWith(
- "some-repository",
- "some-other-name",
- );
- });
-
- it("shows spinner in dock tab", () => {
- expect(
- rendered.getByTestId("install-chart-tab-spinner"),
- ).toBeInTheDocument();
- });
-
- describe("when configuration and versions resolve", () => {
+ describe("when installation resolves", () => {
beforeEach(async () => {
- await callForHelmChartValuesMock.resolve(
- "some-other-default-configuration",
- );
+ await callForCreateHelmReleaseMock.resolve({
+ log: "some-execution-output",
- await callForHelmChartVersionsMock.resolve([]);
+ release: {
+ resources: [],
+ name: "some-release",
+ namespace: "default",
+ version: "some-version",
+ config: "some-config",
+ manifest: "some-manifest",
+
+ info: {
+ deleted: "some-deleted",
+ description: "some-description",
+ first_deployed: "some-first-deployed",
+ last_deployed: "some-last-deployed",
+ notes: "some-notes",
+ status: "some-status",
+ },
+ },
+ });
});
it("renders", () => {
@@ -581,70 +421,351 @@ describe("installing helm chart from new tab", () => {
it("does not show spinner anymore", () => {
expect(
- rendered.queryByTestId("install-chart-tab-spinner"),
+ rendered.queryByTestId(
+ "installing-chart-from-tab-some-first-tab-id",
+ ),
).not.toBeInTheDocument();
});
- it("when installing the second chart, calls for installation of second chart", () => {
- const installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-second-tab-id",
- );
-
- fireEvent.click(installButton);
-
- expect(
- callForCreateHelmReleaseMock,
- ).toHaveBeenCalledWith({
- chart: "some-other-name",
- name: undefined,
- namespace: "default",
- repo: "some-repository",
- values: "some-other-default-configuration",
- version: "some-version",
- });
- });
-
- describe("when selecting the dock tab for installing first chart", () => {
+ describe("when selected to see the installed release", () => {
beforeEach(() => {
- callForHelmChartValuesMock.mockClear();
- callForHelmChartVersionsMock.mockClear();
-
- const tab = rendered.getByTestId(
- "dock-tab-for-some-first-tab-id",
+ const releaseButton = rendered.getByTestId(
+ "show-release-some-release-for-some-first-tab-id",
);
- fireEvent.click(tab);
+ fireEvent.click(releaseButton);
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("does not call for default configuration", () => {
- expect(
- callForHelmChartValuesMock,
- ).not.toHaveBeenCalled();
+ it("shows the details of installed release", () => {
+ const currentPath = windowDi
+ .inject(currentPathInjectable)
+ .get();
+
+ expect(currentPath).toBe(
+ "/helm/releases/default/some-release",
+ );
});
- it("does not call for available versions", () => {
+ it("closes the dock tab", () => {
expect(
- callForHelmChartVersionsMock,
- ).not.toHaveBeenCalled();
+ rendered.queryByTestId(
+ "dock-tab-for-some-first-tab-id",
+ ),
+ ).not.toBeInTheDocument();
+ });
+ });
+
+ describe("when selected to show execution output", () => {
+ beforeEach(() => {
+ const showNotesButton = rendered.getByTestId(
+ "show-execution-output-for-some-release-in-some-first-tab-id",
+ );
+
+ fireEvent.click(showNotesButton);
});
- it("does not show spinner", () => {
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("shows the execution output", () => {
+ expect(
+ rendered.getByTestId(
+ "logs-dialog-for-helm-chart-install",
+ ),
+ ).toHaveTextContent("some-execution-output");
+ });
+
+ it("does not close the dock tab", () => {
+ expect(
+ rendered.getByTestId("dock-tab-for-some-first-tab-id"),
+ ).toBeInTheDocument();
+ });
+ });
+ });
+ });
+
+ describe("given opening details for second chart, when details resolve", () => {
+ beforeEach(async () => {
+ callForHelmChartReadmeMock.mockClear();
+ callForHelmChartVersionsMock.mockClear();
+
+ const row = rendered.getByTestId(
+ "helm-chart-row-for-some-repository-some-other-name",
+ );
+
+ fireEvent.click(row);
+
+ await callForHelmChartVersionsMock.resolve([
+ HelmChart.create({
+ apiVersion: "some-api-version",
+ name: "some-other-name",
+ version: "some-version",
+ repo: "some-repository",
+ created: "2015-10-21T07:28:00Z",
+ description: "some-description",
+ keywords: [],
+ sources: [],
+ urls: [],
+ annotations: {},
+ dependencies: [],
+ maintainers: [],
+ deprecated: false,
+ }),
+ ]);
+
+ await callForHelmChartReadmeMock.resolve("some-readme");
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ describe("when selecting to install second chart", () => {
+ beforeEach(() => {
+ callForHelmChartVersionsMock.mockClear();
+
+ const installButton = rendered.getByTestId(
+ "install-chart-for-some-repository-some-other-name",
+ );
+
+ fireEvent.click(installButton);
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("shows dock tab for installing second chart", () => {
+ expect(
+ rendered.getByTestId(
+ "dock-tab-content-for-some-second-tab-id",
+ ),
+ ).toBeInTheDocument();
+ });
+
+ it("still has the dock tab for installing first chart", () => {
+ expect(
+ rendered.getByTestId("dock-tab-for-some-first-tab-id"),
+ ).toBeInTheDocument();
+ });
+
+ it("calls for default configuration of the second chart", () => {
+ expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
+ "some-repository",
+ "some-other-name",
+ "some-version",
+ );
+ });
+
+ it("calls for available versions for the second chart", () => {
+ expect(callForHelmChartVersionsMock).toHaveBeenCalledWith(
+ "some-repository",
+ "some-other-name",
+ );
+ });
+
+ it("shows spinner in dock tab", () => {
+ expect(
+ rendered.getByTestId("install-chart-tab-spinner"),
+ ).toBeInTheDocument();
+ });
+
+ describe("when configuration and versions resolve", () => {
+ beforeEach(async () => {
+ await callForHelmChartValuesMock.resolve(
+ "some-other-default-configuration",
+ );
+
+ await callForHelmChartVersionsMock.resolve([]);
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("does not show spinner anymore", () => {
expect(
rendered.queryByTestId("install-chart-tab-spinner"),
).not.toBeInTheDocument();
});
- it("when installing the first chart, calls for installation of first chart", () => {
+ it("when installing the second chart, calls for installation of second chart", () => {
const installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
+ "install-chart-from-tab-for-some-second-tab-id",
);
fireEvent.click(installButton);
+ expect(
+ callForCreateHelmReleaseMock,
+ ).toHaveBeenCalledWith({
+ chart: "some-other-name",
+ name: undefined,
+ namespace: "default",
+ repo: "some-repository",
+ values: "some-other-default-configuration",
+ version: "some-version",
+ });
+ });
+
+ describe("when selecting the dock tab for installing first chart", () => {
+ beforeEach(() => {
+ callForHelmChartValuesMock.mockClear();
+ callForHelmChartVersionsMock.mockClear();
+
+ const tab = rendered.getByTestId(
+ "dock-tab-for-some-first-tab-id",
+ );
+
+ fireEvent.click(tab);
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("does not call for default configuration", () => {
+ expect(
+ callForHelmChartValuesMock,
+ ).not.toHaveBeenCalled();
+ });
+
+ it("does not call for available versions", () => {
+ expect(
+ callForHelmChartVersionsMock,
+ ).not.toHaveBeenCalled();
+ });
+
+ it("does not show spinner", () => {
+ expect(
+ rendered.queryByTestId("install-chart-tab-spinner"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("when installing the first chart, calls for installation of first chart", () => {
+ const installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ );
+
+ fireEvent.click(installButton);
+
+ expect(
+ callForCreateHelmReleaseMock,
+ ).toHaveBeenCalledWith({
+ chart: "some-name",
+ name: undefined,
+ namespace: "default",
+ repo: "some-repository",
+ values: "some-default-configuration",
+ version: "some-version",
+ });
+ });
+ });
+ });
+ });
+ });
+
+ describe("given changing version to be installed", () => {
+ let menu: { selectOption: (labelText: string) => void };
+
+ beforeEach(() => {
+ callForHelmChartVersionsMock.mockClear();
+ callForHelmChartValuesMock.mockClear();
+
+ const menuId =
+ "install-chart-version-select-for-some-first-tab-id";
+
+ menu = builder.select.openMenu(menuId);
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ describe("when version is selected", () => {
+ let installButton: HTMLButtonElement;
+
+ beforeEach(() => {
+ installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ ) as HTMLButtonElement;
+
+ menu.selectOption("some-other-version");
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("calls for default configuration for the version of chart", () => {
+ expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
+ "some-repository",
+ "some-name",
+ "some-other-version",
+ );
+ });
+
+ it("shows spinner", () => {
+ expect(
+ rendered.getByTestId(
+ "install-chart-configuration-spinner",
+ ),
+ ).toBeInTheDocument();
+ });
+
+ it("does not call for versions again", () => {
+ expect(
+ callForHelmChartVersionsMock,
+ ).not.toHaveBeenCalled();
+ });
+
+ it("install button is disabled", () => {
+ expect(installButton).toHaveAttribute("disabled");
+ });
+
+ it("stores the selected version", async () => {
+ const readJsonFile = windowDi.inject(readJsonFileInjectable);
+
+ const actual = await readJsonFile(
+ "/some-directory-for-lens-local-storage/some-cluster-id.json",
+ ) as any;
+
+ const version = actual.install_charts["some-first-tab-id"].version;
+
+ expect(version).toBe("some-other-version");
+ });
+
+ describe("when default configuration resolves", () => {
+ beforeEach(async () => {
+ await callForHelmChartValuesMock.resolve(
+ "some-default-configuration-for-other-version",
+ );
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("does not show spinner", () => {
+ expect(
+ rendered.queryByTestId(
+ "install-chart-configuration-spinner",
+ ),
+ ).not.toBeInTheDocument();
+ });
+
+ it("install button is enabled", () => {
+ expect(installButton).not.toHaveAttribute("disabled");
+ });
+
+ it("when installing the chart, calls for installation with changed version and default configuration", () => {
+ fireEvent.click(installButton);
+
expect(
callForCreateHelmReleaseMock,
).toHaveBeenCalledWith({
@@ -652,361 +773,250 @@ describe("installing helm chart from new tab", () => {
name: undefined,
namespace: "default",
repo: "some-repository",
- values: "some-default-configuration",
- version: "some-version",
+ values:
+ "some-default-configuration-for-other-version",
+ version: "some-other-version",
});
});
});
});
});
- });
- describe("given changing version to be installed", () => {
- let menu: { selectOption: (labelText: string) => void };
-
- beforeEach(() => {
- callForHelmChartVersionsMock.mockClear();
- callForHelmChartValuesMock.mockClear();
-
- const menuId =
- "install-chart-version-select-for-some-first-tab-id";
-
- menu = builder.select.openMenu(menuId);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- describe("when version is selected", () => {
- let installButton: HTMLButtonElement;
+ describe("given namespace selection is opened", () => {
+ let menu: { selectOption: (labelText: string) => void };
beforeEach(() => {
- installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
- ) as HTMLButtonElement;
+ const menuId =
+ "install-chart-namespace-select-for-some-first-tab-id";
- menu.selectOption("some-other-version");
+ menu = builder.select.openMenu(menuId);
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("calls for default configuration for the version of chart", () => {
- expect(callForHelmChartValuesMock).toHaveBeenCalledWith(
- "some-repository",
- "some-name",
- "some-other-version",
- );
- });
-
- it("shows spinner", () => {
- expect(
- rendered.getByTestId(
- "install-chart-configuration-spinner",
- ),
- ).toBeInTheDocument();
- });
-
- it("does not call for versions again", () => {
- expect(
- callForHelmChartVersionsMock,
- ).not.toHaveBeenCalled();
- });
-
- it("install button is disabled", () => {
- expect(installButton).toHaveAttribute("disabled");
- });
-
- it("stores the selected version", async () => {
- const readJsonFile = windowDi.inject(readJsonFileInjectable);
-
- const actual = await readJsonFile(
- "/some-directory-for-lens-local-storage/some-cluster-id.json",
- ) as any;
-
- const version = actual.install_charts["some-first-tab-id"].version;
-
- expect(version).toBe("some-other-version");
- });
-
- describe("when default configuration resolves", () => {
- beforeEach(async () => {
- await callForHelmChartValuesMock.resolve(
- "some-default-configuration-for-other-version",
- );
+ describe("when namespace is selected", () => {
+ beforeEach(() => {
+ menu.selectOption("some-other-namespace");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("does not show spinner", () => {
- expect(
- rendered.queryByTestId(
- "install-chart-configuration-spinner",
- ),
- ).not.toBeInTheDocument();
+ it("stores the selected namespace", async () => {
+ const readJsonFile = windowDi.inject(readJsonFileInjectable);
+
+ const actual = await readJsonFile(
+ "/some-directory-for-lens-local-storage/some-cluster-id.json",
+ ) as any;
+
+ const namespace = actual.install_charts["some-first-tab-id"].namespace;
+
+ expect(namespace).toBe("some-other-namespace");
});
- it("install button is enabled", () => {
- expect(installButton).not.toHaveAttribute("disabled");
- });
+ it("when installing the chart, calls for installation with changed namespace", () => {
+ const installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ );
- it("when installing the chart, calls for installation with changed version and default configuration", () => {
fireEvent.click(installButton);
- expect(
- callForCreateHelmReleaseMock,
- ).toHaveBeenCalledWith({
- chart: "some-name",
- name: undefined,
- namespace: "default",
- repo: "some-repository",
- values:
- "some-default-configuration-for-other-version",
- version: "some-other-version",
- });
+ expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith(
+ {
+ chart: "some-name",
+ name: undefined,
+ namespace: "some-other-namespace",
+ repo: "some-repository",
+ values: "some-default-configuration",
+ version: "some-version",
+ },
+ );
});
});
});
- });
- describe("given namespace selection is opened", () => {
- let menu: { selectOption: (labelText: string) => void };
+ describe("given invalid change in configuration", () => {
+ let installButton: HTMLButtonElement;
+ let input: HTMLInputElement;
- beforeEach(() => {
- const menuId =
- "install-chart-namespace-select-for-some-first-tab-id";
-
- menu = builder.select.openMenu(menuId);
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- describe("when namespace is selected", () => {
beforeEach(() => {
- menu.selectOption("some-other-namespace");
+ installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ ) as HTMLButtonElement;
+
+ input = rendered.getByTestId(
+ "monaco-editor-for-some-first-tab-id",
+ ) as HTMLInputElement;
+
+ fireEvent.change(input, {
+ target: { value: "@some-invalid-configuration@" },
+ });
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
- it("stores the selected namespace", async () => {
+ it("updates the editor with the changed value", () => {
+ const input = rendered.getByTestId(
+ "monaco-editor-for-some-first-tab-id",
+ );
+
+ expect(input).toHaveValue("@some-invalid-configuration@");
+ });
+
+ it("install button is disabled", () => {
+ expect(installButton).toHaveAttribute("disabled");
+ });
+
+ it("when valid change in configuration, install button is enabled", () => {
+ fireEvent.change(input, {
+ target: { value: "some-valid-configuration" },
+ });
+
+ expect(installButton).not.toHaveAttribute("disabled");
+ });
+
+ it("given change in version, when default configuration resolves, install button is enabled", async () => {
+ builder.select
+ .openMenu(
+ "install-chart-version-select-for-some-first-tab-id",
+ )
+ .selectOption("some-other-version");
+
+ await callForHelmChartValuesMock.resolve(
+ "some-default-configuration-for-other-version",
+ );
+
+ expect(installButton).not.toHaveAttribute("disabled");
+ });
+ });
+
+ describe("given valid change in configuration", () => {
+ beforeEach(() => {
+ const input = rendered.getByTestId(
+ "monaco-editor-for-some-first-tab-id",
+ );
+
+ fireEvent.change(input, {
+ target: { value: "some-valid-configuration" },
+ });
+ });
+
+ it("updates the editor with the changed value", () => {
+ const input = rendered.getByTestId(
+ "monaco-editor-for-some-first-tab-id",
+ );
+
+ expect(input).toHaveValue("some-valid-configuration");
+ });
+
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
+
+ it("stores the changed configuration", async () => {
const readJsonFile = windowDi.inject(readJsonFileInjectable);
const actual = await readJsonFile(
"/some-directory-for-lens-local-storage/some-cluster-id.json",
) as any;
- const namespace = actual.install_charts["some-first-tab-id"].namespace;
+ const configuration = actual.install_charts["some-first-tab-id"].values;
- expect(namespace).toBe("some-other-namespace");
+ expect(configuration).toBe("some-valid-configuration");
});
- it("when installing the chart, calls for installation with changed namespace", () => {
+ it("does not show spinner", () => {
+ expect(
+ rendered.queryByTestId("install-chart-tab-spinner"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("when installing the chart, calls for installation with changed configuration", () => {
const installButton = rendered.getByTestId(
"install-chart-from-tab-for-some-first-tab-id",
);
fireEvent.click(installButton);
- expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith(
- {
- chart: "some-name",
- name: undefined,
- namespace: "some-other-namespace",
- repo: "some-repository",
- values: "some-default-configuration",
- version: "some-version",
- },
+ expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
+ chart: "some-name",
+ name: undefined,
+ namespace: "default",
+ repo: "some-repository",
+ values: "some-valid-configuration",
+ version: "some-version",
+ });
+ });
+
+ it("given version is changed, when default configuration resolves, defaults back to default configuration", async () => {
+ builder.select
+ .openMenu(
+ "install-chart-version-select-for-some-first-tab-id",
+ )
+ .selectOption("some-other-version");
+
+ await callForHelmChartValuesMock.resolve(
+ "some-default-configuration-for-other-version",
+ );
+
+ const input = rendered.getByTestId(
+ "monaco-editor-for-some-first-tab-id",
+ );
+
+ expect(input).toHaveValue(
+ "some-default-configuration-for-other-version",
);
});
});
- });
- describe("given invalid change in configuration", () => {
- let installButton: HTMLButtonElement;
- let input: HTMLInputElement;
+ describe("given custom name is inputted", () => {
+ beforeEach(() => {
+ const input = rendered.getByTestId(
+ "install-chart-custom-name-input-for-some-first-tab-id",
+ );
- beforeEach(() => {
- installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
- ) as HTMLButtonElement;
+ fireEvent.change(input, {
+ target: { value: "some-custom-name" },
+ });
- input = rendered.getByTestId(
- "monaco-editor-for-some-first-tab-id",
- ) as HTMLInputElement;
-
- fireEvent.change(input, {
- target: { value: "@some-invalid-configuration@" },
- });
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("updates the editor with the changed value", () => {
- const input = rendered.getByTestId(
- "monaco-editor-for-some-first-tab-id",
- );
-
- expect(input).toHaveValue("@some-invalid-configuration@");
- });
-
- it("install button is disabled", () => {
- expect(installButton).toHaveAttribute("disabled");
- });
-
- it("when valid change in configuration, install button is enabled", () => {
- fireEvent.change(input, {
- target: { value: "some-valid-configuration" },
});
- expect(installButton).not.toHaveAttribute("disabled");
- });
+ it("stores the changed custom name", async () => {
+ const readJsonFile = windowDi.inject(readJsonFileInjectable);
- it("given change in version, when default configuration resolves, install button is enabled", async () => {
- builder.select
- .openMenu(
- "install-chart-version-select-for-some-first-tab-id",
- )
- .selectOption("some-other-version");
+ const actual = await readJsonFile(
+ "/some-directory-for-lens-local-storage/some-cluster-id.json",
+ ) as any;
- await callForHelmChartValuesMock.resolve(
- "some-default-configuration-for-other-version",
- );
+ const customName = actual.install_charts["some-first-tab-id"].releaseName;
- expect(installButton).not.toHaveAttribute("disabled");
- });
- });
-
- describe("given valid change in configuration", () => {
- beforeEach(() => {
- const input = rendered.getByTestId(
- "monaco-editor-for-some-first-tab-id",
- );
-
- fireEvent.change(input, {
- target: { value: "some-valid-configuration" },
- });
- });
-
- it("updates the editor with the changed value", () => {
- const input = rendered.getByTestId(
- "monaco-editor-for-some-first-tab-id",
- );
-
- expect(input).toHaveValue("some-valid-configuration");
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("stores the changed configuration", async () => {
- const readJsonFile = windowDi.inject(readJsonFileInjectable);
-
- const actual = await readJsonFile(
- "/some-directory-for-lens-local-storage/some-cluster-id.json",
- ) as any;
-
- const configuration = actual.install_charts["some-first-tab-id"].values;
-
- expect(configuration).toBe("some-valid-configuration");
- });
-
- it("does not show spinner", () => {
- expect(
- rendered.queryByTestId("install-chart-tab-spinner"),
- ).not.toBeInTheDocument();
- });
-
- it("when installing the chart, calls for installation with changed configuration", () => {
- const installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
- );
-
- fireEvent.click(installButton);
-
- expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
- chart: "some-name",
- name: undefined,
- namespace: "default",
- repo: "some-repository",
- values: "some-valid-configuration",
- version: "some-version",
- });
- });
-
- it("given version is changed, when default configuration resolves, defaults back to default configuration", async () => {
- builder.select
- .openMenu(
- "install-chart-version-select-for-some-first-tab-id",
- )
- .selectOption("some-other-version");
-
- await callForHelmChartValuesMock.resolve(
- "some-default-configuration-for-other-version",
- );
-
- const input = rendered.getByTestId(
- "monaco-editor-for-some-first-tab-id",
- );
-
- expect(input).toHaveValue(
- "some-default-configuration-for-other-version",
- );
- });
- });
-
- describe("given custom name is inputted", () => {
- beforeEach(() => {
- const input = rendered.getByTestId(
- "install-chart-custom-name-input-for-some-first-tab-id",
- );
-
- fireEvent.change(input, {
- target: { value: "some-custom-name" },
+ expect(customName).toBe("some-custom-name");
});
- });
+ it("renders", () => {
+ expect(rendered.baseElement).toMatchSnapshot();
+ });
- it("stores the changed custom name", async () => {
- const readJsonFile = windowDi.inject(readJsonFileInjectable);
+ it("when installed, calls for installation with custom name", () => {
+ const installButton = rendered.getByTestId(
+ "install-chart-from-tab-for-some-first-tab-id",
+ );
- const actual = await readJsonFile(
- "/some-directory-for-lens-local-storage/some-cluster-id.json",
- ) as any;
+ fireEvent.click(installButton);
- const customName = actual.install_charts["some-first-tab-id"].releaseName;
-
- expect(customName).toBe("some-custom-name");
- });
-
- it("renders", () => {
- expect(rendered.baseElement).toMatchSnapshot();
- });
-
- it("when installed, calls for installation with custom name", () => {
- const installButton = rendered.getByTestId(
- "install-chart-from-tab-for-some-first-tab-id",
- );
-
- fireEvent.click(installButton);
-
- expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
- chart: "some-name",
- name: "some-custom-name",
- namespace: "default",
- repo: "some-repository",
- values: "some-default-configuration",
- version: "some-version",
+ expect(callForCreateHelmReleaseMock).toHaveBeenCalledWith({
+ chart: "some-name",
+ name: "some-custom-name",
+ namespace: "default",
+ repo: "some-repository",
+ values: "some-default-configuration",
+ version: "some-version",
+ });
});
});
});