Improve Table typing and remove annotations on callbacks (#2981)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-07-22 10:42:27 -04:00
1 parent c6a4d55d86
commit 64ac04186b
59 files changed
+487 -482

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,
+5 -5
View File
@@ -20,7 +20,7 @@
*/
import { CustomResourceDefinition } from "../endpoints";
import type { IKubeObjectMetadata } from "../kube-object";
import type { KubeObjectMetadata } from "../kube-object";
describe("Crds", () => {
describe("getVersion", () => {
@@ -28,7 +28,7 @@ describe("Crds", () => {
const crd = new CustomResourceDefinition({
apiVersion: "foo",
kind: "CustomResourceDefinition",
metadata: {} as IKubeObjectMetadata,
metadata: {} as KubeObjectMetadata,
});
crd.spec = {
@@ -48,7 +48,7 @@ describe("Crds", () => {
const crd = new CustomResourceDefinition({
apiVersion: "foo",
kind: "CustomResourceDefinition",
metadata: {} as IKubeObjectMetadata,
metadata: {} as KubeObjectMetadata,
});
crd.spec = {
@@ -73,7 +73,7 @@ describe("Crds", () => {
const crd = new CustomResourceDefinition({
apiVersion: "foo",
kind: "CustomResourceDefinition",
metadata: {} as IKubeObjectMetadata,
metadata: {} as KubeObjectMetadata,
});
crd.spec = {
@@ -99,7 +99,7 @@ describe("Crds", () => {
const crd = new CustomResourceDefinition({
apiVersion: "foo",
kind: "CustomResourceDefinition",
metadata: {} as IKubeObjectMetadata,
metadata: {} as KubeObjectMetadata,
});
crd.spec = {
+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,