OuiOuiCroissant
OuiOuiCroissant2mo ago

does covnex-test not enforce schemas? (i

does covnex-test not enforce schemas? (i have passed the schema to the test instance parameter) I am able to push garbage data to the db during testing
2 Replies
erquhart
erquhart2mo ago
It does enforce, can you share some code?
OuiOuiCroissant
OuiOuiCroissantOP2mo ago
it("test", async () => {
const t = convexTest(schema);
const check = async () => await t.run(async (ctx) => {
const insertedInvalid = await ctx.db.insert("events", {
type: "payment_event",
eventType: "not_a_valid_event_type",
data: {},
});
return insertedInvalid;

});
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) => {
const insertedInvalid = await ctx.db.insert("events", {
type: "payment_event",
eventType: "not_a_valid_event_type",
data: {},
});
return insertedInvalid;

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

});

Did you find this page helpful?