Skip to content

Commit e084b4c

Browse files
committed
test: reduceSchema dependency unhappy path
1 parent b277a76 commit e084b4c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/compileSchema.reduceSchema.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ describe("compileSchema : reduceNode", () => {
120120
properties: { one: { type: "string" }, two: { type: "string" }, three: { type: "number" } }
121121
});
122122
});
123+
124+
it("should NOT merge dependency when it is not defined", () => {
125+
const node: any = compileSchema({
126+
type: "object",
127+
properties: { one: { type: "string" } },
128+
dependencies: { one: ["two"], two: { type: "number" } }
129+
});
130+
const { node: reduced } = node.reduceNode({});
131+
console.log("reudced schema", reduced.schema);
132+
assert.deepEqual(reduced.schema, {
133+
type: "object",
134+
properties: { one: { type: "string" } }
135+
});
136+
});
137+
123138
it("should NOT add dynamic schema if no data matches dependency", () => {
124139
const { node } = compileSchema({
125140
$ref: "#/$defs/schema",

0 commit comments

Comments
 (0)