brand new unit tests finally
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 2m19s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 2m19s
This commit is contained in:
@@ -21,10 +21,6 @@ describe('VoiceLabPage', () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('should render the initial state correctly', () => {
|
||||
render(<VoiceLabPage />);
|
||||
expect(screen.getByRole('heading', { name: /admin voice lab/i })).toBeInTheDocument();
|
||||
|
||||
@@ -5,13 +5,14 @@ import type { MasterGroceryItem } from '../types';
|
||||
|
||||
// Mock the Google GenAI library
|
||||
const mockGenerateContent = vi.fn();
|
||||
vi.mock('@google/genai', () => {
|
||||
// This mock now correctly simulates a class that can be instantiated with `new`.
|
||||
const mockGoogleGenAI = vi.fn().mockImplementation(() => ({
|
||||
vi.mock('@google/genai', () => ({
|
||||
// Use a standard function to correctly mock a class constructor that can be called with `new`.
|
||||
GoogleGenAI: vi.fn(function() {
|
||||
return {
|
||||
getGenerativeModel: vi.fn(() => ({ generateContent: mockGenerateContent })),
|
||||
}));
|
||||
return { GoogleGenAI: mockGoogleGenAI };
|
||||
});
|
||||
};
|
||||
}),
|
||||
}));
|
||||
|
||||
// Mock fs/promises
|
||||
vi.mock('fs/promises');
|
||||
|
||||
@@ -62,7 +62,10 @@ vi.mock('pdfjs-dist', () => ({
|
||||
|
||||
// Mock react-hot-toast and the notification service that uses it.
|
||||
vi.mock('react-hot-toast', () => ({
|
||||
default: { success: vi.fn(), error: vi.fn() },
|
||||
// Mock the default export (the `toast` object) and the named export `Toaster`.
|
||||
default: { success: vi.fn(), error: vi.fn(), loading: vi.fn() },
|
||||
// The Toaster component can be mocked as a simple function that returns null.
|
||||
Toaster: () => null,
|
||||
}));
|
||||
|
||||
vi.mock('../../services/notificationService', () => ({
|
||||
|
||||
Reference in New Issue
Block a user