lootsa tests fixes
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m29s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m29s
This commit is contained in:
@@ -121,6 +121,9 @@ describe('App Component', () => {
|
||||
authStatus: 'AUTHENTICATED',
|
||||
isLoading: false,
|
||||
});
|
||||
|
||||
// Also mock the API call that might happen inside useAuth or App useEffects
|
||||
mockedApiClient.getAuthenticatedUserProfile.mockResolvedValue(new Response(JSON.stringify(mockAdminProfile)));
|
||||
|
||||
renderApp();
|
||||
|
||||
|
||||
@@ -31,13 +31,16 @@ vi.mock('@google/genai', () => ({
|
||||
}));
|
||||
|
||||
// 3. Robust mock for file system operations
|
||||
// We need to support "import fs from 'fs/promises'" (default export)
|
||||
// AND "import { readFile } from 'fs/promises'" (named export)
|
||||
vi.mock('fs/promises', () => {
|
||||
return {
|
||||
default: {
|
||||
readFile: mockReadFile,
|
||||
},
|
||||
const defaultExport = {
|
||||
readFile: mockReadFile,
|
||||
};
|
||||
return {
|
||||
...defaultExport,
|
||||
default: defaultExport,
|
||||
};
|
||||
});
|
||||
|
||||
// Also mock 'fs' in case it's imported that way
|
||||
|
||||
@@ -10,12 +10,12 @@ mockToastFn.success = successSpy;
|
||||
mockToastFn.error = errorSpy;
|
||||
|
||||
// 3. Mock the module
|
||||
vi.mock('../lib/toast', () => ({
|
||||
default: mockToastFn,
|
||||
// Ensure named exports are also covered if used
|
||||
success: successSpy,
|
||||
error: errorSpy,
|
||||
}));
|
||||
vi.mock('../lib/toast', () => {
|
||||
return {
|
||||
default: mockToastFn,
|
||||
__esModule: true,
|
||||
};
|
||||
});
|
||||
|
||||
describe('Notification Service', () => {
|
||||
beforeAll(() => {
|
||||
|
||||
@@ -161,6 +161,8 @@ vi.mock('../../services/apiClient', () => ({
|
||||
processFlyerFile: vi.fn(),
|
||||
uploadLogoAndUpdateStore: vi.fn(),
|
||||
exportUserData: vi.fn(),
|
||||
getUserAddress: vi.fn(),
|
||||
updateUserAddress: vi.fn(),
|
||||
// --- Admin ---
|
||||
getSuggestedCorrections: vi.fn(),
|
||||
fetchCategories: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user