mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: Add test as repro, and fix bug about kube API details not opening
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
786e0e8ac9
commit
bb400ae667
@ -111,6 +111,20 @@ const tests: KubeApiParseTestData[] = [
|
||||
name: "kube-public",
|
||||
namespace: undefined,
|
||||
}],
|
||||
|
||||
[
|
||||
"/apis/apps/v1/namespaces/default/deployments/some-deployment",
|
||||
{
|
||||
apiBase: "/apis/apps/v1/deployments",
|
||||
apiGroup: "apps",
|
||||
apiPrefix: "/apis",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "apps/v1",
|
||||
name: "some-deployment",
|
||||
namespace: "default",
|
||||
resource: "deployments",
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const invalidTests = [
|
||||
|
||||
@ -46,9 +46,10 @@ export function parseKubeApi(path: string): IKubeApiParsed | undefined {
|
||||
break;
|
||||
}
|
||||
|
||||
let rest: string[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
apiVersion = left.at(-1)!;
|
||||
const rest = left.slice(0, -1);
|
||||
|
||||
[apiVersion, ...rest] = left;
|
||||
apiGroup = rest.join("/");
|
||||
} else {
|
||||
if (left.length === 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user