Skip to content

Commit 2cc34ea

Browse files
committed
test: assert dynamicId for reduce dependencies
1 parent d8fddf8 commit 2cc34ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/compileSchema.reduceSchema.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ describe("compileSchema : reduceNode", () => {
119119
required: ["one", "two", "three"],
120120
properties: { one: { type: "string" }, two: { type: "string" }, three: { type: "number" } }
121121
});
122+
assert.deepEqual(reduced.dynamicId, "#/$defs/schema(dependencies/one,dependencies/two)");
122123
});
123124

124125
it("should NOT merge dependency when it is not defined", () => {
@@ -132,6 +133,7 @@ describe("compileSchema : reduceNode", () => {
132133
type: "object",
133134
properties: { one: { type: "string" } }
134135
});
136+
assert.deepEqual(node.dynamicId, "");
135137
});
136138

137139
it("should NOT add dynamic schema if no data matches dependency", () => {
@@ -151,6 +153,7 @@ describe("compileSchema : reduceNode", () => {
151153
required: [],
152154
properties: { one: { type: "string" }, two: { type: "string" } }
153155
});
156+
assert.deepEqual(node.dynamicId, "");
154157
});
155158

156159
it("should resolve nested dependencies schema", () => {
@@ -181,6 +184,10 @@ describe("compileSchema : reduceNode", () => {
181184
four: { type: "boolean" }
182185
}
183186
});
187+
assert.deepEqual(
188+
node.dynamicId,
189+
"#/$defs/two(dependencies/two)+#/$defs/schema(dependencies/one,#/$defs/two(dependencies/two))"
190+
);
184191
});
185192
});
186193

0 commit comments

Comments
 (0)