Skip to content

Commit 7de578c

Browse files
committed
test: prefixItems with addOptionalProps:true
1 parent e70df22 commit 7de578c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/methods/getData.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,20 @@ describe("getData", () => {
806806
}).getData([43]);
807807
assert.deepEqual(data, [43, 2]);
808808
});
809+
810+
it("should add prefixItems with `addOptionalProps: true`", () => {
811+
const data = compileSchema(
812+
{
813+
type: "array",
814+
prefixItems: [{ type: "boolean", default: true }],
815+
items: { type: "number", default: 2 }
816+
},
817+
{
818+
getDataDefaultOptions: { addOptionalProps: true }
819+
}
820+
).getData();
821+
assert.deepEqual(data, [true]);
822+
});
809823
});
810824

811825
describe("oneOf", () => {

0 commit comments

Comments
 (0)