Making apiBase injectable (#6022)

* Making apiBase injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert all of Helm functions to be DI

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make PortForward's use of apiBase fully injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert all metric requests to be injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Replace resource applier with injectables

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Switch KubeJsonApi.forCluster to be injectable but do not use

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert the rest of shell sessions to be DI-ed

- This is a prerequesit for using the new
  createKubeJsonApiForClusterInjectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Use new createKubeJsonApiForClusterInjectable for openNodeShellSession

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Make KubeconfigDialog injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove jest-fetch-mock and make fetch injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests with new global override

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add new injectable for create KubeJsonApi and JsonApi instances

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix showing-details-for-helm-release behavioural tests

- Remove HelmChartStore in favour of all injectables

- Create a model for UpgradeChartDockTab

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix show details and updating helm releases tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix residual typing issues related to metrics

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix crash on load due to circular dependency

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix create resource tab not working

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove legacy apiBase global

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Introduce and use isDebuggingInjectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Introduce and use windowLocationInjectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove global legacy apiKube

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Improve injectable filenames compared to the injectables inside

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove modifying input in requestActivePortForwardInjectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Introduce and use get(Milli)SecondsFromUnixEpochInjectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Switch to non-reactive way of gettting possible helm release versions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix typo

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix bug in KubeApi constructor

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Convert all KubeApi related tests to use asyncFn

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix unit tests after introducing new injectables that have side effects

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix bad rebase causing tests to fail

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Improve expects for multiple field values

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix crash will looking up api refs

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix breaking change on KubeApi.list

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Better fix for formatting urls

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove injectable for time since we should just use useMockTime

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add happy path behavioural tests for upgrade chart tab

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Remove debug message

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix showing-details-for-helm-release tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix installing-helm-chart-from-new-tab tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests relating to hosted cluster id

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots to recent changes in master

Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>

* Reupdated upgrade chart new tab test snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix flakiness in unit test when using <Animated>

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix flakiness and improve tests for DeleteClusterDialog

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix kubeconfig-sync tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix <Extensions> tests by removing mockFs and making everything injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix build issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix getElectronAppPathInjectable override not returning absolute paths

- Also fixes the listing-active-helm-repos-in-prefs tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Replace all uses of getAbsolutePath with joinPaths as it is more correct and less confusing

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix opening application window tests by making override properly absolute

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots relating no longer using getAbsolutePath

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix and add behavioural tests for RenderDelay

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix extension discovery tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix test flakiness because of path side effects, propagate uses to as many places

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix extension-discovery tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add global override to fix some tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Rewrite and fix implementation of KubeconfigManager and its tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests by global override pathExists

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix unit tests failing on windows by using injectable verions of path functions

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Attempt to fix test timeout by using runInAction

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix tests after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix setupIpcMainHandlers usage

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshots

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
Co-authored-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
authored and GitHub committed 2022-10-05 08:10:36 -04:00
1 parent ed073d6562
commit 76066c5ebf
367 files changed
+16701 -5302

No files matched your search

@@ -661,6 +661,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -670,7 +671,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -1404,6 +1407,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -1413,7 +1417,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -2131,7 +2137,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -2154,6 +2160,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -2212,7 +2219,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -2235,6 +2242,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -2315,6 +2323,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -2324,7 +2333,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -3042,7 +3053,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -3065,6 +3076,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -3123,7 +3135,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -3146,6 +3158,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -3226,6 +3239,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -3235,7 +3249,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -4014,7 +4030,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -4037,6 +4053,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -4095,7 +4112,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -4118,6 +4135,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -4198,6 +4216,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -4207,7 +4226,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -4986,7 +5007,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -5009,6 +5030,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -5067,7 +5089,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -5090,6 +5112,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -5170,6 +5193,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -5179,7 +5203,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -5280,6 +5306,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -5365,7 +5392,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -5419,7 +5446,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -6210,7 +6239,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -6233,6 +6262,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -6291,7 +6321,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -6314,6 +6344,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -6394,6 +6425,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -6403,7 +6435,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -6504,6 +6538,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -6589,7 +6624,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -6643,7 +6678,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -7434,7 +7471,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -7457,6 +7494,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -7515,7 +7553,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -7538,6 +7576,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -7618,6 +7657,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -7627,7 +7667,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -7728,6 +7770,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -7813,7 +7856,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -7867,7 +7910,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -8008,7 +8053,7 @@ exports[`showing details for helm release given application is started when navi
</body>
`;
exports[`showing details for helm release given application is started when navigating to helm releases when releases resolve when selecting release to see details when call for release resolve with release when configuration resolves when changing the configuration when saving when update resolves with failure renders 1`] = `
exports[`showing details for helm release given application is started when navigating to helm releases when releases resolve when selecting release to see details when call for release resolve with release when configuration resolves when changing the configuration when saving when requestHelmCharts resolves when requestHelmChartVersions resolves when update resolves with failure renders 1`] = `
<body>
<div>
<div
@@ -8669,6 +8714,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -8678,7 +8724,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -8779,6 +8827,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -8864,7 +8913,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -8918,7 +8967,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -9059,7 +9110,7 @@ exports[`showing details for helm release given application is started when navi
</body>
`;
exports[`showing details for helm release given application is started when navigating to helm releases when releases resolve when selecting release to see details when call for release resolve with release when configuration resolves when changing the configuration when saving when update resolves with success renders 1`] = `
exports[`showing details for helm release given application is started when navigating to helm releases when releases resolve when selecting release to see details when call for release resolve with release when configuration resolves when changing the configuration when saving when requestHelmCharts resolves when requestHelmChartVersions resolves when update resolves with success renders 1`] = `
<body>
<div>
<div
@@ -9720,6 +9771,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -9729,7 +9781,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -9830,6 +9884,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -9915,7 +9970,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -9969,7 +10024,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -10762,7 +10819,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -10785,6 +10842,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -10843,7 +10901,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -10866,6 +10924,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -10946,6 +11005,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -10955,7 +11015,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -11056,6 +11118,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@@ -11141,7 +11204,7 @@ exports[`showing details for helm release given application is started when navi
class="flex gaps align-center"
>
<span>
some-chart
some-chart-1.0.0
</span>
<button
class="Button box right upgrade primary"
@@ -11195,7 +11258,9 @@ exports[`showing details for helm release given application is started when navi
<div
class="version flex gaps align-center"
>
<span />
<span>
1.0.0
</span>
</div>
</span>
</div>
@@ -11986,7 +12051,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -12009,6 +12074,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -12067,7 +12133,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -12090,6 +12156,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -12170,6 +12237,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -12179,7 +12247,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -12219,6 +12289,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-some-tab-id"
tabindex="0"
>
<span
@@ -12228,7 +12299,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-some-tab-id"
>
Close ⌘+W
</div>
</div>
@@ -12955,7 +13028,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -12978,6 +13051,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -13036,7 +13110,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -13059,6 +13133,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -13139,6 +13214,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -13148,7 +13224,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -13930,7 +14008,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -13953,6 +14031,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -14011,7 +14090,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -14034,6 +14113,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -14114,6 +14194,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -14123,7 +14204,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -14841,7 +14924,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -14864,6 +14947,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -14922,7 +15006,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -14945,6 +15029,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -15025,6 +15110,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -15034,7 +15120,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -15813,7 +15901,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
1.0.0
</div>
<div
class="TableCell app-version"
@@ -15836,6 +15924,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@@ -15894,7 +15983,7 @@ exports[`showing details for helm release given application is started when navi
<div
class="TableCell version"
>
2.0.0
</div>
<div
class="TableCell app-version"
@@ -15917,6 +16006,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@@ -15997,6 +16087,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@@ -16006,7 +16097,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@@ -9,27 +9,38 @@ import type { RenderResult } from "@testing-library/react";
import { fireEvent } from "@testing-library/react";
import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
import type { CallForHelmReleases } from "../../renderer/components/+helm-releases/call-for-helm-releases/call-for-helm-releases.injectable";
import callForHelmReleasesInjectable from "../../renderer/components/+helm-releases/call-for-helm-releases/call-for-helm-releases.injectable";
import namespaceStoreInjectable from "../../renderer/components/+namespaces/store.injectable";
import type { NamespaceStore } from "../../renderer/components/+namespaces/store";
import type { CallForHelmReleaseConfiguration } from "../../renderer/components/+helm-releases/release-details/release-details-model/call-for-helm-release-configuration/call-for-helm-release-configuration.injectable";
import callForHelmReleaseConfigurationInjectable from "../../renderer/components/+helm-releases/release-details/release-details-model/call-for-helm-release-configuration/call-for-helm-release-configuration.injectable";
import type { CallForHelmReleaseUpdate } from "../../renderer/components/+helm-releases/update-release/call-for-helm-release-update/call-for-helm-release-update.injectable";
import callForHelmReleaseUpdateInjectable from "../../renderer/components/+helm-releases/update-release/call-for-helm-release-update/call-for-helm-release-update.injectable";
import type { RequestHelmReleases } from "../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
import requestHelmReleasesInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
import type { RequestHelmReleaseConfiguration } from "../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
import requestHelmReleaseConfigurationInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
import type { RequestHelmReleaseUpdate } from "../../common/k8s-api/endpoints/helm-releases.api/request-update.injectable";
import requestHelmReleaseUpdateInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-update.injectable";
import { useFakeTime } from "../../common/test-utils/use-fake-time";
import type { CallForHelmRelease, DetailedHelmRelease } from "../../renderer/components/+helm-releases/release-details/release-details-model/call-for-helm-release/call-for-helm-release.injectable";
import callForHelmReleaseInjectable from "../../renderer/components/+helm-releases/release-details/release-details-model/call-for-helm-release/call-for-helm-release.injectable";
import type { RequestDetailedHelmRelease } from "../../renderer/components/+helm-releases/release-details/release-details-model/request-detailed-helm-release.injectable";
import requestDetailedHelmReleaseInjectable from "../../renderer/components/+helm-releases/release-details/release-details-model/request-detailed-helm-release.injectable";
import showSuccessNotificationInjectable from "../../renderer/components/notifications/show-success-notification.injectable";
import showCheckedErrorInjectable from "../../renderer/components/notifications/show-checked-error.injectable";
import getRandomUpgradeChartTabIdInjectable from "../../renderer/components/dock/upgrade-chart/get-random-upgrade-chart-tab-id.injectable";
import type { RequestHelmCharts } from "../../common/k8s-api/endpoints/helm-charts.api/request-charts.injectable";
import type { RequestHelmChartVersions } from "../../common/k8s-api/endpoints/helm-charts.api/request-versions.injectable";
import type { RequestHelmChartReadme } from "../../common/k8s-api/endpoints/helm-charts.api/request-readme.injectable";
import type { RequestHelmChartValues } from "../../common/k8s-api/endpoints/helm-charts.api/request-values.injectable";
import requestHelmChartsInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-charts.injectable";
import requestHelmChartVersionsInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-versions.injectable";
import requestHelmChartReadmeInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-readme.injectable";
import requestHelmChartValuesInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-values.injectable";
import { HelmChart } from "../../common/k8s-api/endpoints/helm-charts.api";
describe("showing details for helm release", () => {
let builder: ApplicationBuilder;
let callForHelmReleasesMock: AsyncFnMock<CallForHelmReleases>;
let callForHelmReleaseMock: AsyncFnMock<CallForHelmRelease>;
let callForHelmReleaseConfigurationMock: AsyncFnMock<CallForHelmReleaseConfiguration>;
let callForHelmReleaseUpdateMock: AsyncFnMock<CallForHelmReleaseUpdate>;
let requestHelmReleasesMock: AsyncFnMock<RequestHelmReleases>;
let requestDetailedHelmReleaseMock: AsyncFnMock<RequestDetailedHelmRelease>;
let requestHelmReleaseConfigurationMock: AsyncFnMock<RequestHelmReleaseConfiguration>;
let requestHelmReleaseUpdateMock: AsyncFnMock<RequestHelmReleaseUpdate>;
let requestHelmChartsMock: AsyncFnMock<RequestHelmCharts>;
let requestHelmChartVersionsMock: AsyncFnMock<RequestHelmChartVersions>;
let requestHelmChartReadmeMock: AsyncFnMock<RequestHelmChartReadme>;
let requestHelmChartValuesMock: AsyncFnMock<RequestHelmChartValues>;
let showSuccessNotificationMock: jest.Mock;
let showCheckedErrorNotificationMock: jest.Mock;
@@ -40,60 +51,36 @@ describe("showing details for helm release", () => {
builder.setEnvironmentToClusterFrame();
callForHelmReleasesMock = asyncFn();
callForHelmReleaseMock = asyncFn();
callForHelmReleaseConfigurationMock = asyncFn();
callForHelmReleaseUpdateMock = asyncFn();
requestHelmReleasesMock = asyncFn();
requestDetailedHelmReleaseMock = asyncFn();
requestHelmReleaseConfigurationMock = asyncFn();
requestHelmReleaseUpdateMock = asyncFn();
requestHelmChartsMock = asyncFn();
requestHelmChartVersionsMock = asyncFn();
requestHelmChartReadmeMock = asyncFn();
requestHelmChartValuesMock = asyncFn();
showSuccessNotificationMock = jest.fn();
showCheckedErrorNotificationMock = jest.fn();
builder.beforeWindowStart((windowDi) => {
windowDi.override(
getRandomUpgradeChartTabIdInjectable,
() => () => "some-tab-id",
);
windowDi.override(
showSuccessNotificationInjectable,
() => showSuccessNotificationMock,
);
windowDi.override(
showCheckedErrorInjectable,
() => showCheckedErrorNotificationMock,
);
windowDi.override(
callForHelmReleasesInjectable,
() => callForHelmReleasesMock,
);
windowDi.override(
callForHelmReleaseInjectable,
() => callForHelmReleaseMock,
);
windowDi.override(
callForHelmReleaseConfigurationInjectable,
() => callForHelmReleaseConfigurationMock,
);
windowDi.override(
callForHelmReleaseUpdateInjectable,
() => callForHelmReleaseUpdateMock,
);
windowDi.override(
namespaceStoreInjectable,
() =>
({
contextNamespaces: ["some-namespace", "some-other-namespace"],
items: [],
selectNamespaces: () => {},
} as unknown as NamespaceStore),
);
windowDi.override(getRandomUpgradeChartTabIdInjectable, () => () => "some-tab-id");
windowDi.override(showSuccessNotificationInjectable, () => showSuccessNotificationMock);
windowDi.override(showCheckedErrorInjectable, () => showCheckedErrorNotificationMock);
windowDi.override(requestHelmReleasesInjectable, () => requestHelmReleasesMock);
windowDi.override(requestDetailedHelmReleaseInjectable, () => requestDetailedHelmReleaseMock);
windowDi.override(requestHelmReleaseConfigurationInjectable, () => requestHelmReleaseConfigurationMock);
windowDi.override(requestHelmReleaseUpdateInjectable, () => requestHelmReleaseUpdateMock);
windowDi.override(requestHelmChartsInjectable, () => requestHelmChartsMock);
windowDi.override(requestHelmChartVersionsInjectable, () => requestHelmChartVersionsMock);
windowDi.override(requestHelmChartReadmeInjectable, () => requestHelmChartReadmeMock);
windowDi.override(requestHelmChartValuesInjectable, () => requestHelmChartValuesMock);
});
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-namespace");
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-other-namespace");
});
describe("given application is started", () => {
@@ -119,7 +106,7 @@ describe("showing details for helm release", () => {
});
it("calls for releases for each selected namespace", () => {
expect(callForHelmReleasesMock.mock.calls).toEqual([
expect(requestHelmReleasesMock.mock.calls).toEqual([
["some-namespace"],
["some-other-namespace"],
]);
@@ -132,22 +119,22 @@ describe("showing details for helm release", () => {
});
it("when releases resolve but there is none, renders", async () => {
await callForHelmReleasesMock.resolve([]);
await callForHelmReleasesMock.resolve([]);
await requestHelmReleasesMock.resolve([]);
await requestHelmReleasesMock.resolve([]);
expect(rendered.baseElement).toMatchSnapshot();
});
describe("when releases resolve", () => {
beforeEach(async () => {
await callForHelmReleasesMock.resolveSpecific(
await requestHelmReleasesMock.resolveSpecific(
([namespace]) => namespace === "some-namespace",
[
{
appVersion: "some-app-version",
name: "some-name",
namespace: "some-namespace",
chart: "some-chart",
chart: "some-chart-1.0.0",
status: "some-status",
updated: "some-updated",
revision: "some-revision",
@@ -155,14 +142,14 @@ describe("showing details for helm release", () => {
],
);
await callForHelmReleasesMock.resolveSpecific(
await requestHelmReleasesMock.resolveSpecific(
([namespace]) => namespace === "some-other-namespace",
[
{
appVersion: "some-other-app-version",
name: "some-other-name",
namespace: "some-other-namespace",
chart: "some-other-chart",
chart: "some-other-chart-2.0.0",
status: "some-other-status",
updated: "some-other-updated",
revision: "some-other-revision",
@@ -201,7 +188,7 @@ describe("showing details for helm release", () => {
});
it("calls for release", () => {
expect(callForHelmReleaseMock).toHaveBeenCalledWith(
expect(requestDetailedHelmReleaseMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
);
@@ -215,7 +202,7 @@ describe("showing details for helm release", () => {
describe("when opening details for second release", () => {
beforeEach(() => {
callForHelmReleaseMock.mockClear();
requestDetailedHelmReleaseMock.mockClear();
const row = rendered.getByTestId(
"helm-release-row-for-some-other-namespace/some-other-name",
@@ -229,7 +216,7 @@ describe("showing details for helm release", () => {
});
it("calls for another release", () => {
expect(callForHelmReleaseMock).toHaveBeenCalledWith(
expect(requestDetailedHelmReleaseMock).toHaveBeenCalledWith(
"some-other-name",
"some-other-namespace",
);
@@ -269,7 +256,7 @@ describe("showing details for helm release", () => {
describe("when opening details for same release", () => {
beforeEach(() => {
callForHelmReleaseMock.mockClear();
requestDetailedHelmReleaseMock.mockClear();
const row = rendered.getByTestId(
"helm-release-row-for-some-namespace/some-name",
@@ -283,15 +270,14 @@ describe("showing details for helm release", () => {
});
it("does not reload", () => {
expect(callForHelmReleaseMock).not.toHaveBeenCalled();
expect(requestDetailedHelmReleaseMock).not.toHaveBeenCalled();
});
});
});
describe("when call for release resolves with error", () => {
beforeEach(async () => {
await callForHelmReleaseMock.resolve({
await requestDetailedHelmReleaseMock.resolve({
callWasSuccessful: false,
error: "some-error",
});
@@ -314,15 +300,55 @@ describe("showing details for helm release", () => {
});
it("does not call for release configuration", () => {
expect(callForHelmReleaseConfigurationMock).not.toHaveBeenCalled();
expect(requestHelmReleaseConfigurationMock).not.toHaveBeenCalled();
});
});
describe("when call for release resolve with release", () => {
beforeEach(async () => {
await callForHelmReleaseMock.resolve({
await requestDetailedHelmReleaseMock.resolve({
callWasSuccessful: true,
response: detailedReleaseFake,
response: {
release: {
appVersion: "some-app-version",
chart: "some-chart-1.0.0",
status: "some-status",
updated: "some-updated",
revision: "some-revision",
name: "some-name",
namespace: "some-namespace",
},
details: {
name: "some-name",
namespace: "some-namespace",
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",
},
resources: [
{
kind: "some-kind",
apiVersion: "some-api-version",
metadata: {
uid: "some-uid",
name: "some-resource",
namespace: "some-namespace",
creationTimestamp: "2015-10-22T07:28:00Z",
},
},
],
},
},
});
});
@@ -331,7 +357,7 @@ describe("showing details for helm release", () => {
});
it("calls for release configuration", () => {
expect(callForHelmReleaseConfigurationMock).toHaveBeenCalledWith(
expect(requestHelmReleaseConfigurationMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
true,
@@ -340,7 +366,7 @@ describe("showing details for helm release", () => {
describe("when configuration resolves", () => {
beforeEach(async () => {
await callForHelmReleaseConfigurationMock.resolve(
await requestHelmReleaseConfigurationMock.resolve(
"some-configuration",
);
});
@@ -405,12 +431,12 @@ describe("showing details for helm release", () => {
});
it("does not save changes yet", () => {
expect(callForHelmReleaseUpdateMock).not.toHaveBeenCalled();
expect(requestHelmReleaseUpdateMock).not.toHaveBeenCalled();
});
describe("when toggling to see only user defined values", () => {
beforeEach(() => {
callForHelmReleaseConfigurationMock.mockClear();
requestHelmReleaseConfigurationMock.mockClear();
const toggle = rendered.getByTestId(
"user-supplied-values-only-checkbox",
@@ -420,7 +446,7 @@ describe("showing details for helm release", () => {
});
it("calls for only user defined configuration", () => {
expect(callForHelmReleaseConfigurationMock).toHaveBeenCalledWith(
expect(requestHelmReleaseConfigurationMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
false,
@@ -429,7 +455,7 @@ describe("showing details for helm release", () => {
describe("when configuration resolves", () => {
beforeEach(async () => {
await callForHelmReleaseConfigurationMock.resolve(
await requestHelmReleaseConfigurationMock.resolve(
"some-other-configuration",
);
});
@@ -447,7 +473,7 @@ describe("showing details for helm release", () => {
});
it("when toggling again, calls for all configuration", () => {
callForHelmReleaseConfigurationMock.mockClear();
requestHelmReleaseConfigurationMock.mockClear();
const toggle = rendered.getByTestId(
"user-supplied-values-only-checkbox",
@@ -455,7 +481,7 @@ describe("showing details for helm release", () => {
fireEvent.click(toggle);
expect(callForHelmReleaseConfigurationMock).toHaveBeenCalledWith(
expect(requestHelmReleaseConfigurationMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
true,
@@ -477,20 +503,6 @@ describe("showing details for helm release", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("calls for update", () => {
expect(callForHelmReleaseUpdateMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
{
chart: "some-chart",
repo: "",
values: "some-new-configuration",
version: "",
},
);
});
it("shows spinner", () => {
const saveButton = rendered.getByTestId(
"helm-release-configuration-save-button",
@@ -499,78 +511,115 @@ describe("showing details for helm release", () => {
expect(saveButton).toHaveClass("waiting");
});
describe("when update resolves with success", () => {
describe("when requestHelmCharts resolves", () => {
beforeEach(async () => {
callForHelmReleasesMock.mockClear();
callForHelmReleaseConfigurationMock.mockClear();
await callForHelmReleaseUpdateMock.resolve({
updateWasSuccessful: true,
await requestHelmChartsMock.resolve([HelmChart.create({
apiVersion: "1.2.3",
version: "1.0.0",
created: "at-some-time",
name: "some-chart",
repo: "some-repo",
})]);
});
describe("when requestHelmChartVersions resolves", () => {
beforeEach(async () => {
await requestHelmChartVersionsMock.resolve([HelmChart.create({
apiVersion: "1.2.3",
version: "1.0.0",
created: "at-some-time",
name: "some-chart",
repo: "some-repo",
})]);
});
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("calls for update", () => {
expect(requestHelmReleaseUpdateMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
it("does not show spinner anymore", () => {
const saveButton = rendered.getByTestId(
"helm-release-configuration-save-button",
);
expect(saveButton).not.toHaveClass("waiting");
});
it("reloads the configuration", () => {
expect(callForHelmReleaseConfigurationMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
true,
);
});
it("shows success notification", () => {
expect(showSuccessNotificationMock).toHaveBeenCalled();
});
it("does not show error notification", () => {
expect(showCheckedErrorNotificationMock).not.toHaveBeenCalled();
});
});
describe("when update resolves with failure", () => {
beforeEach(async () => {
callForHelmReleasesMock.mockClear();
callForHelmReleaseConfigurationMock.mockClear();
await callForHelmReleaseUpdateMock.resolve({
updateWasSuccessful: false,
error: "some-error",
{
chart: "some-chart",
repo: "some-repo",
values: "some-new-configuration",
version: "1.0.0",
},
);
});
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
describe("when update resolves with success", () => {
beforeEach(async () => {
requestHelmReleasesMock.mockClear();
requestHelmReleaseConfigurationMock.mockClear();
it("does not show spinner anymore", () => {
const saveButton = rendered.getByTestId(
"helm-release-configuration-save-button",
);
await requestHelmReleaseUpdateMock.resolve({
updateWasSuccessful: true,
});
});
expect(saveButton).not.toHaveClass("waiting");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not reload the configuration", () => {
expect(callForHelmReleaseConfigurationMock).not.toHaveBeenCalled();
});
it("does not show spinner anymore", () => {
const saveButton = rendered.getByTestId(
"helm-release-configuration-save-button",
);
it("does not show success notification", () => {
expect(showSuccessNotificationMock).not.toHaveBeenCalled();
});
expect(saveButton).not.toHaveClass("waiting");
});
it("shows error notification", () => {
expect(showCheckedErrorNotificationMock).toHaveBeenCalled();
it("reloads the configuration", () => {
expect(requestHelmReleaseConfigurationMock).toHaveBeenCalledWith(
"some-name",
"some-namespace",
true,
);
});
it("shows success notification", () => {
expect(showSuccessNotificationMock).toHaveBeenCalled();
});
it("does not show error notification", () => {
expect(showCheckedErrorNotificationMock).not.toHaveBeenCalled();
});
});
describe("when update resolves with failure", () => {
beforeEach(async () => {
requestHelmReleasesMock.mockClear();
requestHelmReleaseConfigurationMock.mockClear();
await requestHelmReleaseUpdateMock.resolve({
updateWasSuccessful: false,
error: "some-error",
});
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not show spinner anymore", () => {
const saveButton = rendered.getByTestId(
"helm-release-configuration-save-button",
);
expect(saveButton).not.toHaveClass("waiting");
});
it("does not reload the configuration", () => {
expect(requestHelmReleaseConfigurationMock).not.toHaveBeenCalled();
});
it("does not show success notification", () => {
expect(showSuccessNotificationMock).not.toHaveBeenCalled();
});
it("shows error notification", () => {
expect(showCheckedErrorNotificationMock).toHaveBeenCalled();
});
});
});
});
});
@@ -582,45 +631,3 @@ describe("showing details for helm release", () => {
});
});
});
const detailedReleaseFake: DetailedHelmRelease = {
release: {
appVersion: "some-app-version",
chart: "some-chart",
status: "some-status",
updated: "some-updated",
revision: "some-revision",
name: "some-name",
namespace: "some-namespace",
},
details: {
name: "some-name",
namespace: "some-namespace",
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",
},
resources: [
{
kind: "some-kind",
apiVersion: "some-api-version",
metadata: {
uid: "some-uid",
name: "some-resource",
namespace: "some-namespace",
creationTimestamp: "2015-10-22T07:28:00Z",
},
},
],
},
};