Skip to content

Commit

Permalink
fix: bug fixed and tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Mar 12, 2024
1 parent 516cea9 commit 6f9b06e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/index.test.ts
Expand Up @@ -128,7 +128,7 @@ describe("traverse", () => {

traverse(testSchema, mockMutation);

testCalls(mockMutation, testSchema)
testCalls(mockMutation, testSchema, false, 1, false);
expect(mockMutation).toHaveBeenCalledTimes(1);
});

Expand Down
4 changes: 2 additions & 2 deletions src/parent.test.ts
Expand Up @@ -3,7 +3,7 @@ import traverse from "./";
import { JSONSchema } from "@json-schema-tools/meta-schema";

describe("traverse parent", () => {
const test = (s: JSONSchema, parents: JSONSchema[]) => {
const test = (s: JSONSchema, parents: Array<JSONSchema | undefined>) => {
const mutator = jest.fn((s) => s);

traverse(s, mutator);
Expand Down Expand Up @@ -207,7 +207,7 @@ describe("traverse parent", () => {
describe("schema is a boolean", () => {
it("allows root schema as boolean", () => {
const testSchema: JSONSchema = true;
test(testSchema, [testSchema]);
test(testSchema, [undefined]);
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/paths.test.ts
Expand Up @@ -2,7 +2,7 @@ import traverse from "./";
import { JSONSchema } from "@json-schema-tools/meta-schema";

describe("traverse paths", () => {
const test = (s: JSONSchema, paths: string[]) => {
const test = (s: JSONSchema, paths: string[], isRoot: boolean = false) => {
const mutator = jest.fn((s) => s);

traverse(s, mutator);
Expand All @@ -12,15 +12,15 @@ describe("traverse paths", () => {
expect.anything(),
expect.any(Boolean),
path,
expect.anything(),
isRoot ? undefined : expect.anything()
);
});
};

describe("schema is a boolean", () => {
it("allows root schema as boolean", () => {
const testSchema: any = true;
test(testSchema, ["$"]);
test(testSchema, ["$"], true);
});
});

Expand Down

0 comments on commit 6f9b06e

Please sign in to comment.