Improve Table typing and remove annotations on callbacks

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-06-07 11:30:28 -04:00
1 parent 22c9d03edb
commit defb0ea0dd
55 files changed
+498 -490

No files matched your search

@@ -22,8 +22,9 @@
import { ingressStore } from "../../components/+network-ingresses/ingress.store";
import { apiManager } from "../api-manager";
import { KubeApi } from "../kube-api";
import { KubeObject } from "../kube-object";
class TestApi extends KubeApi {
class TestApi extends KubeApi<KubeObject> {
protected async checkPreferredVersion() {
return;
@@ -36,6 +37,7 @@ describe("ApiManager", () => {
const apiBase = "apis/v1/foo";
const fallbackApiBase = "/apis/extensions/v1beta1/foo";
const kubeApi = new TestApi({
objectConstructor: KubeObject,
apiBase,
fallbackApiBases: [fallbackApiBase],
checkPreferredVersion: true,
+9 -6
View File
@@ -20,6 +20,7 @@
*/
import { KubeApi } from "../kube-api";
import { KubeObject } from "../kube-object";
describe("KubeApi", () => {
it("uses url from apiBase if apiBase contains the resource", async () => {
@@ -29,7 +30,7 @@ describe("KubeApi", () => {
body: JSON.stringify({
resources: [{
name: "ingresses"
}] as any []
}] as any[]
})
};
} else if (request.url === "/api-kube/apis/extensions/v1beta1") {
@@ -38,13 +39,13 @@ describe("KubeApi", () => {
body: JSON.stringify({
resources: [{
name: "ingresses"
}] as any []
}] as any[]
})
};
} else {
return {
body: JSON.stringify({
resources: [] as any []
resources: [] as any[]
})
};
}
@@ -53,6 +54,7 @@ describe("KubeApi", () => {
const apiBase = "/apis/networking.k8s.io/v1/ingresses";
const fallbackApiBase = "/apis/extensions/v1beta1/ingresses";
const kubeApi = new KubeApi({
objectConstructor: KubeObject,
apiBase,
fallbackApiBases: [fallbackApiBase],
checkPreferredVersion: true,
@@ -68,7 +70,7 @@ describe("KubeApi", () => {
if (request.url === "/api-kube/apis/networking.k8s.io/v1") {
return {
body: JSON.stringify({
resources: [] as any []
resources: [] as any[]
})
};
} else if (request.url === "/api-kube/apis/extensions/v1beta1") {
@@ -76,13 +78,13 @@ describe("KubeApi", () => {
body: JSON.stringify({
resources: [{
name: "ingresses"
}] as any []
}] as any[]
})
};
} else {
return {
body: JSON.stringify({
resources: [] as any []
resources: [] as any[]
})
};
}
@@ -91,6 +93,7 @@ describe("KubeApi", () => {
const apiBase = "apis/networking.k8s.io/v1/ingresses";
const fallbackApiBase = "/apis/extensions/v1beta1/ingresses";
const kubeApi = new KubeApi({
objectConstructor: KubeObject,
apiBase,
fallbackApiBases: [fallbackApiBase],
checkPreferredVersion: true,