fix: resolve all TypeScript strict-mode errors in test files
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 21m52s

- convert-sanitized: use 'as Record' cast for optional mock call args
- error-responses: fix module path (database.js → db.js) and mock return type
- recover-initial-db-fallback: fix mock return type (undefined → true)
- render-timing: remove non-existent .prepare property check
- usage-flush: cast mock request objects to any for test setup

Zero tsc --noEmit errors. 608 tests passing.
This commit is contained in:
DocFast CEO 2026-03-09 17:12:22 +01:00
parent c52dec2380
commit 54316d45cf
5 changed files with 13 additions and 13 deletions

View file

@ -226,12 +226,12 @@ describe("Error Response Security - Admin Cleanup", () => {
const mockAdminAuth = (req: any, res: any, next: any) => next();
// Mock database functions
vi.mock("../services/database.js", () => ({
vi.mock("../services/db.js", () => ({
cleanupStaleData: vi.fn(),
}));
const { cleanupStaleData } = await import("../services/database.js");
vi.mocked(cleanupStaleData).mockResolvedValue({ deletedCount: 5 });
const { cleanupStaleData } = await import("../services/db.js");
vi.mocked(cleanupStaleData).mockResolvedValue({ expiredVerifications: 3, orphanedUsage: 2 });
// Create minimal app
app = express();
@ -250,7 +250,7 @@ describe("Error Response Security - Admin Cleanup", () => {
});
it("does not expose error message (no 'message' field)", async () => {
const { cleanupStaleData } = await import("../services/database.js");
const { cleanupStaleData } = await import("../services/db.js");
const internalError = new Error("Database connection pool exhausted");
vi.mocked(cleanupStaleData).mockRejectedValue(internalError);