Skip to content

Commit

Permalink
Create initial test skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
samayer12 committed Nov 4, 2024
1 parent 3d867b7 commit 72f4311
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/lib/validate-processor.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { describe, expect, it } from "@jest/globals";
import { validateProcessor } from "./validate-processor";
import { Capability } from "./capability";
import { KubernetesObject } from "kubernetes-fluent-client";
import { AdmissionRequest } from "./types";
import { Operation } from "./enums";

describe("validate-processor tests", () => {
const defaultModuleConfig = { uuid: "some-uuid", alwaysIgnore: { namespaces: [] } };
const defaultCapabilities: Capability[] = [];
const defaultRequestMetadata = {};
const defaultRequest: AdmissionRequest<KubernetesObject> = {
operation: Operation.CREATE,
uid: "test-uid",
kind: {
group: "",
version: "v1",
kind: "Pod",
},
resource: {
group: "",
version: "v1",
resource: "pods",
},
name: "test-pod",
userInfo: {
username: "test-user",
groups: ["test-group"],
},
object: {
apiVersion: "v1",
kind: "Pod",
metadata: {
name: "test-pod",
labels: {
"test-label": "true",
},
annotations: {
"test-annotation": "true",
},
},
},
};

it("should return an empty validate response", async () => {
const result = await validateProcessor(
defaultModuleConfig,
defaultCapabilities,
defaultRequest,
defaultRequestMetadata,
);
expect(result).toStrictEqual([]);
});
});

0 comments on commit 72f4311

Please sign in to comment.