test: add vitest baseline for critical payment and auth guards

This commit is contained in:
2026-04-03 18:15:18 +02:00
parent 2542748e82
commit 68416ed9de
12 changed files with 730 additions and 75 deletions

View File

@@ -12,6 +12,7 @@ import {
IMAGE_MODELS,
} from "./openrouter";
import type { Id } from "./_generated/dataModel";
import { assertNodeBelongsToCanvasOrThrow } from "./ai-utils";
const MAX_IMAGE_RETRIES = 2;
@@ -526,9 +527,7 @@ export const generateImage = action({
if (!node) {
throw new Error("Node not found");
}
if (node.canvasId !== args.canvasId) {
throw new Error("Node does not belong to canvas");
}
assertNodeBelongsToCanvasOrThrow(node, args.canvasId);
const userId = canvas.ownerId;
const verifiedCanvasId = canvas._id;