one moar time - we can do it?
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 32m32s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 32m32s
This commit is contained in:
@@ -1,26 +1,3 @@
|
||||
// --- FIX REGISTRY ---
|
||||
//
|
||||
// // 2025-12-09: Fixed "TypeError: ... is not a constructor" in `queueService` and `connection.db` tests.
|
||||
// ISSUE: `vi.fn(() => ...)` creates a mock implementation using an arrow function.
|
||||
// Arrow functions cannot be instantiated with `new`.
|
||||
// FIX: Changed mock implementations to `vi.fn(function() { ... })`. Standard functions
|
||||
// have a `[[Construct]]` method and support `new`.
|
||||
//
|
||||
// 2025-12-09: Addressed "Cannot access before initialization" in `auth.routes.test.ts`.
|
||||
// ISSUE: `vi.mock` is hoisted above top-level `import` statements. Referencing imported
|
||||
// variables (like `db` or `types`) inside the mock factory fails.
|
||||
// FIX: Moved variable creation inside `vi.hoisted` or the mock factory itself,
|
||||
// removing the dependency on the top-level import within the mock definition.
|
||||
//
|
||||
// 2025-12-09: Explicitly mocked 'pg' module using `vi.hoisted` and `vi.mock` within this test file.
|
||||
// This ensures `Pool` is a proper Vitest spy, allowing `expect(Pool).toHaveBeenCalledTimes(1)`
|
||||
// and `mockImplementation` overrides to work correctly, resolving "not a spy" errors.
|
||||
//
|
||||
// 2024-08-01: Corrected tests to assert against the globally mocked `mockPoolInstance` instead of spying
|
||||
// on the `pg.Pool` constructor. This aligns the test with the global mock setup in
|
||||
// `tests-setup-unit.ts` and fixes incorrect assertions.
|
||||
//
|
||||
// --- END FIX REGISTRY ---
|
||||
// src/services/db/connection.db.test.ts
|
||||
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user