1
0
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:
Janne Savolainen 2023-05-09 09:48:19 +03:00
parent 786e0e8ac9
commit bb400ae667
2 changed files with 17 additions and 2 deletions

View File

@ -111,6 +111,20 @@ const tests: KubeApiParseTestData[] = [
name: "kube-public", name: "kube-public",
namespace: undefined, 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 = [ const invalidTests = [

View File

@ -46,9 +46,10 @@ export function parseKubeApi(path: string): IKubeApiParsed | undefined {
break; 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("/"); apiGroup = rest.join("/");
} else { } else {
if (left.length === 0) { if (left.length === 0) {