feat: init

This commit is contained in:
montaghanmy
2023-03-23 11:03:16 +01:00
commit 10fe6f78d1
11518 changed files with 509786 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { describe, expect, it } from "@jest/globals";
import * as pickUtils from "../../src/utils/pick";
describe("The pick utils", () => {
describe("The pick function", () => {
it("should return an object wich contains only the defined properties", () => {
class TestClass {
keep: string;
me: string;
skip: string;
}
const keysToKeep = ["keep", "me"] as const;
const object = { keep: "foo", me: "bar", skip: "baz" } as TestClass;
const result = pickUtils.pick(object, ...keysToKeep);
expect(result).toEqual({ keep: "foo", me: "bar" });
expect(result).not.toContain("skip");
});
it("should return an empty object when input is empty", () => {
class TestClass {
keep: string;
me: string;
skip: string;
}
const keysToKeep = [] as const;
const object = { keep: "foo", me: "bar", skip: "baz" } as TestClass;
const result = pickUtils.pick(object, ...keysToKeep);
expect(result).toEqual({});
});
});
});