fix(tests): inject mock staff context in clients test suite

RBAC Phase 2 added row-level scoping that reads c.get("staff") on every
clients route. The test app had no middleware setting this context, causing
a TypeError (undefined.role) and 500 responses on all GET tests.

Add a manager-role mock staff middleware to the test Hono app so the
existing tests continue to cover the non-groomer code path.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Flea Flicker
2026-03-27 01:52:25 +00:00
parent cd5feb1a14
commit 0fa53645b9
+4
View File
@@ -105,6 +105,10 @@ vi.mock("@groombook/db", () => {
const { clientsRouter } = await import("../routes/clients.js");
const app = new Hono();
app.use("*", async (c, next) => {
c.set("staff", { id: "staff-uuid-1", role: "manager" } as never);
await next();
});
app.route("/clients", clientsRouter);
function jsonRequest(method: string, path: string, body?: unknown) {