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

Update tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-10-04 15:19:51 -04:00
parent 7bb31e11ad
commit 40d3bf5bb9
3 changed files with 3 additions and 206 deletions

View File

@ -5552,11 +5552,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -5571,11 +5566,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>
@ -6784,11 +6774,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -6803,11 +6788,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>
@ -8016,11 +7996,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -8035,11 +8010,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>
@ -9073,11 +9043,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -9092,11 +9057,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>
@ -10132,11 +10092,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -10151,11 +10106,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>
@ -11364,11 +11314,6 @@ exports[`showing details for helm release given application is started when navi
>
Namespace
</div>
<div
class="TableCell age"
>
Age
</div>
</div>
<div
class="TableRow"
@ -11383,11 +11328,6 @@ exports[`showing details for helm release given application is started when navi
>
some-namespace
</div>
<div
class="TableCell age"
>
0s
</div>
</div>
</div>
</div>

View File

@ -11,7 +11,6 @@ export type GetHelmReleaseResources = (
name: string,
namespace: string,
kubeconfigPath: string,
kubectlPath: string
) => Promise<AsyncResult<KubeJsonApiData[], string>>;
const getHelmReleaseResourcesInjectable = getInjectable({

View File

@ -44,7 +44,6 @@ describe("get helm release resources", () => {
"some-release",
"some-namespace",
"/some-kubeconfig-path",
"/some-kubectl-path",
);
});
@ -66,150 +65,9 @@ describe("get helm release resources", () => {
const actual = await actualPromise;
expect(actual).toEqual([]);
});
describe("when call for manifest resolves", () => {
beforeEach(async () => {
await execHelmMock.resolve({
callWasSuccessful: true,
response: `---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-with-same-namespace
namespace: some-namespace
---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-without-namespace
---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-with-different-namespace
namespace: some-other-namespace
---
`,
});
});
it("calls for resources from each namespace separately using the manifest as input", () => {
expect(execFileWithStreamInputMock.mock.calls).toEqual([
[
{
filePath: "/some-kubectl-path",
commandArguments: ["get", "--kubeconfig", "/some-kubeconfig-path", "-f", "-", "--namespace", "some-namespace", "--output", "json"],
input: `---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-with-same-namespace
namespace: some-namespace
---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-without-namespace
---
`,
},
],
[
{
filePath: "/some-kubectl-path",
commandArguments: ["get", "--kubeconfig", "/some-kubeconfig-path", "-f", "-", "--namespace", "some-other-namespace", "--output", "json"],
input: `---
apiVersion: v1
kind: SomeKind
metadata:
name: some-resource-with-different-namespace
namespace: some-other-namespace
---
`,
},
],
]);
});
it("when all calls for resources resolve, resolves with combined result", async () => {
await execFileWithStreamInputMock.resolveSpecific(
([{ commandArguments }]) =>
commandArguments.includes("some-namespace"),
{
callWasSuccessful: true,
response: JSON.stringify({
items: [{ some: "item" }],
kind: "List",
metadata: {
resourceVersion: "",
selfLink: "",
},
}),
},
);
await execFileWithStreamInputMock.resolveSpecific(
([{ commandArguments }]) =>
commandArguments.includes("some-other-namespace"),
{
callWasSuccessful: true,
response: JSON.stringify({
items: [{ some: "other-item" }],
kind: "List",
metadata: {
resourceVersion: "",
selfLink: "",
},
}),
},
);
const actual = await actualPromise;
expect(actual).toEqual([{ some: "item" }, { some: "other-item" }]);
});
it("given some call fails, when all calls have finished, rejects with failure", async () => {
await execFileWithStreamInputMock.resolveSpecific(
([{ commandArguments }]) =>
commandArguments.includes("some-namespace"),
{
callWasSuccessful: true,
response: JSON.stringify({
items: [{ some: "item" }],
kind: "List",
metadata: {
resourceVersion: "",
selfLink: "",
},
}),
},
);
execFileWithStreamInputMock.resolveSpecific(
([{ commandArguments }]) =>
commandArguments.includes("some-other-namespace"),
{
callWasSuccessful: false,
error: "some-error",
},
);
return expect(actualPromise).rejects.toEqual(expect.any(Error));
expect(actual).toEqual({
callWasSuccessful: true,
response: [],
});
});
});