mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix parseApi to be more consitent with the older version
- Add many more unit tests (these are exact copies of the old behaviour so that any changes do not change behaviour) - Make explicit, with documentation, why certain actions are being taken with the parsing of the api URL parts Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
1 parent
1107ff3e43
commit
f68b96efe3
2 files changed
+98
-12
No files matched your search
@@ -46,18 +46,57 @@ const tests: ParseAPITest[] = [
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "/apis/namespaces/default/es/gke-svc-vodka-1-app-1-w-l-1-9eea2bfe-4jnl",
|
||||
url: "/api/v1/namespaces",
|
||||
expected: {
|
||||
apiBase: "/apis",
|
||||
apiPrefix: "/apis",
|
||||
apiGroup: undefined,
|
||||
apiVersion: undefined,
|
||||
apiVersionWithGroup: "",
|
||||
resource: undefined,
|
||||
apiBase: "/api/v1/namespaces",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "namespaces",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "/api/v1/secrets",
|
||||
expected: {
|
||||
apiBase: "/api/v1/secrets",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "secrets",
|
||||
name: undefined,
|
||||
namespace: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "/api/v1/nodes/minikube",
|
||||
expected: {
|
||||
apiBase: "/api/v1/nodes",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "v1",
|
||||
apiVersionWithGroup: "v1",
|
||||
resource: "nodes",
|
||||
name: "minikube",
|
||||
namespace: undefined,
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "/api/foo-bar/nodes/minikube",
|
||||
expected: {
|
||||
apiBase: "/api/foo-bar/nodes",
|
||||
apiPrefix: "/api",
|
||||
apiGroup: "",
|
||||
apiVersion: "foo-bar",
|
||||
apiVersionWithGroup: "foo-bar",
|
||||
resource: "nodes",
|
||||
name: "minikube",
|
||||
namespace: undefined,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
jest.mock('../kube-watch-api.ts', () => 'KubeWatchApi');
|
||||
|
||||
Reference in new issue
Block a user