import { describe, it, expect } from "vitest"; describe("AuthenticatedRequest type", () => { it("should be importable from types module", async () => { const mod = await import("../src/types.js"); // Type exists — this is a compile-time check; runtime just verifies module loads expect(mod).toBeDefined(); }); it("should allow apiKeyInfo on typed request in auth middleware", async () => { // Verify auth middleware compiles without 'as any' cast const authMod = await import("../src/middleware/auth.js"); expect(authMod.authMiddleware).toBeTypeOf("function"); }); it("should allow usage middleware to access apiKeyInfo without any cast", async () => { const usageMod = await import("../src/middleware/usage.js"); expect(usageMod.usageMiddleware).toBeTypeOf("function"); }); it("should allow pdfRateLimit middleware to use AuthenticatedRequest", async () => { const mod = await import("../src/middleware/pdfRateLimit.js"); expect(mod.pdfRateLimitMiddleware).toBeTypeOf("function"); }); });