lootsa tests fixes
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m29s

This commit is contained in:
2025-12-05 23:58:45 -08:00
parent aaf1bc3fdb
commit bf9dd8bad3
4 changed files with 18 additions and 10 deletions

View File

@@ -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();

View File

@@ -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

View File

@@ -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(() => {

View File

@@ -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(),