import { readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; describe("routine remove authorization wiring", () => { it("scopes remove lookups to the acting user like update and testRun", () => { const routerSource = readFileSync( resolve(dirname(fileURLToPath(import.meta.url)), "router.ts"), "utf8", ); const removeHandler = routerSource.match( /remove: authed\.routines\.remove\.handler\(async \(\{ context, input \}\) => \{[\s\S]*?\}\),/, )?.[0]; expect(removeHandler).toBeTruthy(); expect(removeHandler).toContain("userId: context.actor.userId"); }); });