unit tests fixin
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 37s

This commit is contained in:
2025-11-22 00:25:35 -08:00
parent 97bb1a3966
commit a4c19ce864
3 changed files with 9 additions and 5 deletions

2
package-lock.json generated
View File

@@ -67,7 +67,7 @@
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"testcontainers": "^11.8.1", "testcontainers": "^11.8.1",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "~5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.47.0", "typescript-eslint": "^8.47.0",
"vite": "^7.2.4", "vite": "^7.2.4",
"vitest": "^4.0.13" "vitest": "^4.0.13"

View File

@@ -6,7 +6,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "DEBUG=\"tailwindcss:*\" vite build --debug", "build": "DEBUG=\"tailwindcss:*\" vite build --debug",
"preview": "vite preview", "preview": "vite preview",
"test": "vitest run --coverage", "test": "vitest run --coverage",
"test:integration": "vitest run --project integration", "test:integration": "vitest run --project integration",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -72,7 +72,7 @@
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"testcontainers": "^11.8.1", "testcontainers": "^11.8.1",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "~5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.47.0", "typescript-eslint": "^8.47.0",
"vite": "^7.2.4", "vite": "^7.2.4",
"vitest": "^4.0.13" "vitest": "^4.0.13"

View File

@@ -19,7 +19,11 @@ vi.mock('pg', async (importOriginal) => {
return { return {
...pg, ...pg,
// Override the Pool constructor. Now, any module that calls `new Pool()` // Override the Pool constructor. Now, any module that calls `new Pool()`
// will receive our singleton `testPool` instance instead of creating a new one. // will receive our singleton `testPool` instance.
Pool: vi.fn(() => testPool), // We use `mockImplementation` to return the instance, which is the correct
// way to mock a class constructor that should return a specific instance.
Pool: vi.fn().mockImplementation(() => {
return testPool;
}),
}; };
}); });