fix: correct i18n mock in CrowdSec tests and silence query warning

- Added [ready: true](http://_vscodecontentref_/6) to [react-i18next](http://_vscodecontentref_/7) mock in CrowdSecBouncerKeyDisplay tests to prevent infinite loading state
- Mocked [getCrowdsecKeyStatus](http://_vscodecontentref_/8) in Security page tests to resolve "Query data cannot be undefined" warning
- Ensures all Security dashboard related tests pass reliably without console errors
This commit is contained in:
GitHub Actions
2026-02-06 05:24:06 +00:00
parent b37922de28
commit 92bdf471e8
5 changed files with 230 additions and 220 deletions

View File

@@ -44,6 +44,7 @@ vi.mock('react-i18next', () => ({
}
return translations[key] || key
},
ready: true,
}),
}))

View File

@@ -84,6 +84,12 @@ describe('Security page', () => {
// Mock WebSocket connections for LiveLogViewer
vi.mocked(logsApi.connectLiveLogs).mockReturnValue(vi.fn())
vi.mocked(logsApi.connectSecurityLogs).mockReturnValue(vi.fn())
vi.mocked(crowdsecApi.getCrowdsecKeyStatus).mockResolvedValue({
env_key_rejected: false,
key_source: 'auto-generated',
current_key_preview: '...',
message: 'OK'
})
})
it('shows banner when all services are disabled and links to docs', async () => {