many fixes resulting from latest refactoring
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 8m3s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 8m3s
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
// --- FIX REGISTRY ---
|
||||
//
|
||||
// 2024-07-29: Updated `vi.mock` for `../services/db/index.db` to use `vi.hoisted` and `importOriginal`.
|
||||
// This preserves named exports (like repository classes) from the original module,
|
||||
// fixing 'undefined' errors when other modules tried to import them from the mock.
|
||||
// 1) Updated `vi.mock` for `../services/db/index.db` to use `vi.hoisted` and `importOriginal`.
|
||||
// This preserves named exports (like repository classes) from the original module,
|
||||
// fixing 'undefined' errors when other modules tried to import them from the mock.
|
||||
//
|
||||
// 2) Added a `default` export to the `node:fs/promises` mock. This resolves import errors
|
||||
// in modules that use the `import fs from 'node:fs/promises'` syntax.
|
||||
//
|
||||
// --- END FIX REGISTRY ---
|
||||
|
||||
// src/routes/admin.content.routes.test.ts
|
||||
@@ -56,8 +60,14 @@ vi.mock('../services/db/index.db', async (importOriginal) => {
|
||||
vi.mock('../services/db/recipe.db');
|
||||
vi.mock('../services/db/user.db');
|
||||
vi.mock('node:fs/promises', () => ({
|
||||
// Named exports
|
||||
writeFile: vi.fn().mockResolvedValue(undefined),
|
||||
unlink: vi.fn().mockResolvedValue(undefined),
|
||||
// FIX: Add default export to handle `import fs from ...` syntax.
|
||||
default: {
|
||||
writeFile: vi.fn().mockResolvedValue(undefined),
|
||||
unlink: vi.fn().mockResolvedValue(undefined),
|
||||
},
|
||||
}));
|
||||
vi.mock('../services/backgroundJobService');
|
||||
vi.mock('../services/geocodingService.server');
|
||||
|
||||
Reference in New Issue
Block a user