1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix another test suite

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-03-06 16:12:24 -05:00
parent 759ec6706d
commit 4632ce7e3f
3 changed files with 16 additions and 8 deletions

View File

@ -78,9 +78,12 @@ describe("showing details for helm release", () => {
});
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-namespace");
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-other-namespace");
builder.afterWindowStart(() => {
builder.namespaces.select("some-namespace");
builder.namespaces.select("some-other-namespace");
});
});
describe("given application is started", () => {
@ -106,10 +109,9 @@ describe("showing details for helm release", () => {
});
it("calls for releases for each selected namespace", () => {
expect(requestHelmReleasesMock.mock.calls).toEqual([
["some-namespace"],
["some-other-namespace"],
]);
expect(requestHelmReleasesMock).toBeCalledTimes(2);
expect(requestHelmReleasesMock).toBeCalledWith("some-namespace");
expect(requestHelmReleasesMock).toBeCalledWith("some-other-namespace");
});
it("shows spinner", () => {

View File

@ -25,7 +25,7 @@ const releasesInjectable = getInjectable({
const releaseArrays = await (
clusterContext.hasSelectedAll
? requestHelmReleases()
: Promise.all(clusterContext.contextNamespaces.map(requestHelmReleases))
: Promise.all(clusterContext.contextNamespaces.map((namespace) => requestHelmReleases(namespace)))
);
return releaseArrays.flat().map(toHelmRelease);

View File

@ -69,6 +69,7 @@ import fsInjectable from "../../../common/fs/fs.injectable";
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
import homeDirectoryPathInjectable from "../../../common/os/home-directory-path.injectable";
import { testUsingFakeTime } from "../../../common/test-utils/use-fake-time";
import selectedNamespacesStorageInjectable from "../../../features/namespace-filtering/renderer/storage.injectable";
type Callback = (di: DiContainer) => void | Promise<void>;
@ -369,7 +370,12 @@ export const getApplicationBuilder = () => {
namespaces.add(namespace);
namespaceItems.replace(createNamespacesFor(namespaces));
}),
select: action((namespace) => selectedNamespaces.add(namespace)),
select: action((namespace) => {
const selectedNamespacesStorage = builder.applicationWindow.only.di.inject(selectedNamespacesStorageInjectable);
selectedNamespaces.add(namespace);
selectedNamespacesStorage.set([...selectedNamespaces]);
}),
},
applicationMenu: {
get items() {