OuiOuiCroissant
OuiOuiCroissant2mo ago

convex-test schema validation

I appear to be having issues with the convex-test library. Even though I pass the schema to my test instances `convexTest(schema), I am able to insert faulty documents using t.run => ctx.db.insert. Is this a known limitation of the library?
1 Reply
OuiOuiCroissant
OuiOuiCroissantOP2mo ago
it("test", async () => {
const t = convexTest(schema);
const check = async () => await t.run(async (ctx) => {
return await ctx.db.insert("events", {
type: "payment_event",
eventType: "not_a_valid_event_type",
data: {},
});


});
expect(check).rejects.toThrow(); console.log("Check:", check); // this prints out the document id

});
it("test", async () => {
const t = convexTest(schema);
const check = async () => await t.run(async (ctx) => {
return await ctx.db.insert("events", {
type: "payment_event",
eventType: "not_a_valid_event_type",
data: {},
});


});
expect(check).rejects.toThrow(); console.log("Check:", check); // this prints out the document id

});

Did you find this page helpful?