test: add vitest baseline for critical payment and auth guards
This commit is contained in:
22
tests/convex/ai-utils.test.ts
Normal file
22
tests/convex/ai-utils.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { assertNodeBelongsToCanvasOrThrow } from "@/convex/ai-utils";
|
||||
|
||||
describe("assertNodeBelongsToCanvasOrThrow", () => {
|
||||
it("accepts matching node/canvas relation", () => {
|
||||
expect(() =>
|
||||
assertNodeBelongsToCanvasOrThrow(
|
||||
{ canvasId: "canvas_a" },
|
||||
"canvas_a",
|
||||
),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("rejects mismatching node/canvas relation", () => {
|
||||
expect(() =>
|
||||
assertNodeBelongsToCanvasOrThrow(
|
||||
{ canvasId: "canvas_b" },
|
||||
"canvas_a",
|
||||
),
|
||||
).toThrow("Node does not belong to canvas");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user