From ea4907cf4bea1af2c2f1151c027aed888b7015fd Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Thu, 28 May 2026 00:21:04 +0800 Subject: [PATCH] fix: resolve TypeScript errors in domain-block-api test (Task 8) --- lib/api/__tests__/domain-block-api.test.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/api/__tests__/domain-block-api.test.ts b/lib/api/__tests__/domain-block-api.test.ts index 8930c72..8a84c93 100644 --- a/lib/api/__tests__/domain-block-api.test.ts +++ b/lib/api/__tests__/domain-block-api.test.ts @@ -6,14 +6,17 @@ import { isDeckyVaultEmail, DOMAIN_BLOCK_ERROR } from "@/lib/auth/domain-block" * The domain-block onBeforeHandle handler – mirrors the logic * wired into the auth group in lib/api/app.ts. Tested in isolation * here so we don't need to stand up the full app / DB. + * + * The handler is typed loosely to avoid Elysia's complex context type + * in test environments — the actual type safety is verified against + * the real app.ts implementation at integration test time. */ -const domainBlockOnBeforeHandle = async ({ - request, - set, -}: { - request: Request - set: { status: number } -}) => { +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const domainBlockOnBeforeHandle = async (context: any) => { + const { request, set } = context as { + request: Request + set: { status: number } + } const url = new URL(request.url) const isSignUp = url.pathname === "/api/auth/sign-up/email" && @@ -111,4 +114,4 @@ describe("domain block middleware", () => { expect(res.status).toBe(200) }) -}) \ No newline at end of file +})