Skip to content

Commit 6f9b06e

Browse files
committed
fix: bug fixed and tests fixed
1 parent 516cea9 commit 6f9b06e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe("traverse", () => {
128128

129129
traverse(testSchema, mockMutation);
130130

131-
testCalls(mockMutation, testSchema)
131+
testCalls(mockMutation, testSchema, false, 1, false);
132132
expect(mockMutation).toHaveBeenCalledTimes(1);
133133
});
134134

src/parent.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import traverse from "./";
33
import { JSONSchema } from "@json-schema-tools/meta-schema";
44

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

99
traverse(s, mutator);
@@ -207,7 +207,7 @@ describe("traverse parent", () => {
207207
describe("schema is a boolean", () => {
208208
it("allows root schema as boolean", () => {
209209
const testSchema: JSONSchema = true;
210-
test(testSchema, [testSchema]);
210+
test(testSchema, [undefined]);
211211
});
212212
});
213213

src/paths.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import traverse from "./";
22
import { JSONSchema } from "@json-schema-tools/meta-schema";
33

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

88
traverse(s, mutator);
@@ -12,15 +12,15 @@ describe("traverse paths", () => {
1212
expect.anything(),
1313
expect.any(Boolean),
1414
path,
15-
expect.anything(),
15+
isRoot ? undefined : expect.anything()
1616
);
1717
});
1818
};
1919

2020
describe("schema is a boolean", () => {
2121
it("allows root schema as boolean", () => {
2222
const testSchema: any = true;
23-
test(testSchema, ["$"]);
23+
test(testSchema, ["$"], true);
2424
});
2525
});
2626

0 commit comments

Comments
 (0)