try try again - almost giving up
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m25s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m25s
This commit is contained in:
@@ -120,7 +120,7 @@ describe('App Component', () => {
|
||||
|
||||
renderApp();
|
||||
|
||||
// --- FIX LEDGER --- KEEP THIS UPDATED
|
||||
// --- FIX LEDGER ---
|
||||
// 1. Expect `bulk-importer-mock`. Failed (Element not found).
|
||||
// Reason: `AdminPage` is mocked, so its children (including BulkImporter) are not rendered.
|
||||
// 2. Current Strategy: Expect `admin-page-mock`. This proves routing to /admin worked.
|
||||
|
||||
@@ -32,8 +32,9 @@ vi.mock('@google/genai', () => ({
|
||||
|
||||
// --- FIX LEDGER ---
|
||||
// 1. Mock `fs/promises` default export. Failed.
|
||||
// 2. Mock `fs` and `node:fs`. Failed.
|
||||
// 3. Current Strategy: Mock modules to return the HOISTED mock variables directly.
|
||||
// 2. Mock `fs` and `node:fs` using external object. Failed (hoisting issue).
|
||||
// 3. Mock modules to return the HOISTED mock variables directly. Failed.
|
||||
// 4. Current Strategy: Inline mock definitions inside vi.mock factory to guarantee availability and correct structure.
|
||||
|
||||
vi.mock('fs', () => ({
|
||||
default: { readFile: mockReadFile, promises: { readFile: mockReadFile } },
|
||||
|
||||
@@ -3,8 +3,8 @@ import { describe, it, expect, vi, beforeEach, beforeAll, type Mock } from 'vite
|
||||
// --- FIX LEDGER ---
|
||||
// 1. Initial attempt: Spy on default export property. Failed (0 calls).
|
||||
// 2. Attempt: Hoisted spies attached to default export. Failed (0 calls).
|
||||
// 3. Current Strategy: Mock the module to return a simple object structure for default export.
|
||||
// Using vi.hoisted to ensure spies are available to both the factory and the test body.
|
||||
// 3. Attempt: Function-as-object mock. Failed (TS error / 0 calls).
|
||||
// 4. Current Strategy: Mock module to return a plain object as default export, matching import usage.
|
||||
|
||||
const { successSpy, errorSpy } = vi.hoisted(() => ({
|
||||
successSpy: vi.fn(),
|
||||
@@ -12,11 +12,11 @@ const { successSpy, errorSpy } = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
vi.mock('../lib/toast', () => {
|
||||
const toastFn = vi.fn();
|
||||
(toastFn as any).success = successSpy;
|
||||
(toastFn as any).error = errorSpy;
|
||||
return {
|
||||
default: toastFn,
|
||||
default: {
|
||||
success: successSpy,
|
||||
error: errorSpy,
|
||||
},
|
||||
success: successSpy,
|
||||
error: errorSpy,
|
||||
__esModule: true,
|
||||
@@ -61,7 +61,7 @@ describe('Notification Service', () => {
|
||||
|
||||
notifySuccess(message);
|
||||
|
||||
// Verify using the local spy
|
||||
// Verify using the hoisted spy
|
||||
expect(successSpy).toHaveBeenCalledTimes(1);
|
||||
expect(successSpy).toHaveBeenCalledWith(
|
||||
message,
|
||||
|
||||
@@ -57,7 +57,7 @@ afterEach(cleanup);
|
||||
// by the factory. However, we define the Constructor function INSIDE the factory
|
||||
// or via a standard function expression to ensure it remains constructible.
|
||||
const { mockPoolInstance } = vi.hoisted(() => {
|
||||
console.log('[DEBUG] tests-setup-unit.ts: Initializing hoisted mock variables');
|
||||
console.log('[DEBUG] unit-setup.ts: Initializing hoisted mock variables');
|
||||
const mockQuery = vi.fn().mockResolvedValue({ rows: [], rowCount: 0 });
|
||||
const mockRelease = vi.fn();
|
||||
const mockConnect = vi.fn().mockResolvedValue({
|
||||
@@ -87,12 +87,12 @@ export { mockPoolInstance };
|
||||
* We define the MockPool function INSIDE the factory to ensure it remains a standard function.
|
||||
*/
|
||||
vi.mock('pg', () => {
|
||||
console.log('[DEBUG] tests-setup-unit.ts: vi.mock("pg") factory executing');
|
||||
console.log('[DEBUG] unit-setup.ts: vi.mock("pg") factory executing');
|
||||
|
||||
// FIX: Use a standard function expression for the Mock Pool Constructor.
|
||||
// This ensures `new Pool()` works at runtime.
|
||||
const MockPool = function() {
|
||||
console.log('[DEBUG] tests-setup-unit.ts: MockPool constructor called via "new"!');
|
||||
console.log('[DEBUG] unit-setup.ts: MockPool constructor called via "new"!');
|
||||
return mockPoolInstance;
|
||||
};
|
||||
|
||||
@@ -161,6 +161,7 @@ vi.mock('../../services/apiClient', () => ({
|
||||
processFlyerFile: vi.fn(),
|
||||
uploadLogoAndUpdateStore: vi.fn(),
|
||||
exportUserData: vi.fn(),
|
||||
// --- Address ---
|
||||
getUserAddress: vi.fn(),
|
||||
updateUserAddress: vi.fn(),
|
||||
// --- Admin ---
|
||||
|
||||
Reference in New Issue
Block a user