Browse Source

Fix i18next warning in frontend tests

- Initialize i18n in test setup to suppress 'NO_I18NEXT_INSTANCE' warning
- Update AMSHistoryModal tests to use actual translated text

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
maziggy 5 months ago
parent
commit
dc92816515

+ 2 - 2
frontend/src/__tests__/components/AMSHistoryModal.test.tsx

@@ -243,7 +243,7 @@ describe('AMSHistoryModal', () => {
     render(<AMSHistoryModal {...defaultProps} />);
 
     await waitFor(() => {
-      expect(screen.getByText('Error loading data')).toBeInTheDocument();
+      expect(screen.getByText('Error')).toBeInTheDocument();
     });
   });
 
@@ -261,7 +261,7 @@ describe('AMSHistoryModal', () => {
     render(<AMSHistoryModal {...defaultProps} />);
 
     await waitFor(() => {
-      expect(screen.getByText('No data available for this time range')).toBeInTheDocument();
+      expect(screen.getByText('No data available')).toBeInTheDocument();
     });
   });
 

+ 3 - 0
frontend/src/__tests__/setup.ts

@@ -8,6 +8,9 @@ import { afterAll, afterEach, beforeAll, vi } from 'vitest';
 import { cleanup } from '@testing-library/react';
 import { server } from './mocks/server';
 
+// Initialize i18n for tests (suppresses react-i18next warnings)
+import '../i18n';
+
 // Setup MSW server - bypass WebSocket requests so our mock handles them
 beforeAll(() =>
   server.listen({