MCPcopy Create free account
hub / github.com/OneNoteDev/WebClipper / tests

Method tests

src/tests/logging/context_tests.ts:20–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 }
19
20 protected tests() {
21 test("NoRequirements should always return true regardless of what is put in", () => {
22 ok(this.noReq.requirementsAreMet(undefined), "No requirements returned false, which should never happen");
23 });
24
25 test("ProductionRequirements should return false for an empty or undefined argument", () => {
26 strictEqual(this.prod.requirementsAreMet(undefined), false, "ProdRequirements incorrectly returned true for an undefined object");
27 strictEqual(this.prod.requirementsAreMet({}), false, "ProdRequirements incorrectly returned true for an empty object");
28 });
29
30 test("ProductionRequirements should return false for a subset of properties that don't meet the full property set", () => {
31 let partiallyFilledProps = {
32 a: "bar",
33 b: "baz"
34 } as { [key: string]: string | number | boolean };
35 strictEqual(this.prod.requirementsAreMet(partiallyFilledProps), false, "requirementsAreMet incorrectly returned true when the contextProps passed in did not match those injected at construction");
36 });
37
38 test("ProductionRequirements should return true for properties that meet exactly the requirements", () => {
39 let fullyFilledProps = {
40 a: "bar",
41 b: "baz",
42 c: "foo"
43 } as { [key: string]: string | number | boolean };
44 strictEqual(this.prod.requirementsAreMet(fullyFilledProps), true, "requirementsAreMet incorrectly returned false when the contextProps passed in matched the requirements injected at construction");
45 });
46
47 test("ProductionRequirements should return true for props that exceed the props injected at constructin", () => {
48 let excessProps = {
49 a: "a",
50 b: "b",
51 c: "c",
52 d: "d"
53 } as { [key: string]: string | number | boolean };
54 strictEqual(this.prod.requirementsAreMet(excessProps), true, "requirementsAreMet incorrectly returned false when the contextProps passed in exceeded the requirements injected at construction");
55 });
56 }
57}
58
59(new ContextTests()).runTests();

Callers

nothing calls this directly

Calls 1

requirementsAreMetMethod · 0.65

Tested by

no test coverage detected