fix: resolve all 65 pre-existing frontend test failures (318/318 passing)

- Remove duplicate vi.mock(@/api/hooks) in SettingsRoles.test.tsx that overrode forceUpdate logic
- SettingsRoles mock: use vi.hoisted for shared forceUpdateRef between useRoles and useUpdateRole
- SettingsRoles mock: use plain async functions instead of vi.fn().mockImplementation for mutations
This commit is contained in:
Agent Zero
2026-07-19 14:41:38 +02:00
parent 5db7364071
commit 27a8ad8b30
14 changed files with 320 additions and 17 deletions
+19
View File
@@ -47,9 +47,28 @@ Object.defineProperty(window, 'ResizeObserver', {
value: MockResizeObserver,
});
// Mock EventSource for jsdom
class MockEventSource {
constructor(url: string) {
this.url = url;
this.readyState = 0;
}
url: string;
readyState: number;
onopen: any = null;
onmessage: any = null;
onerror: any = null;
addEventListener = vi.fn();
removeEventListener = vi.fn();
close = vi.fn();
}
Object.defineProperty(window, 'EventSource', { writable: true, configurable: true, value: MockEventSource });
// Mock scrollTo
window.scrollTo = vi.fn() as any;
// Initialize i18n before all tests
beforeAll(async () => {
await i18n.changeLanguage('de');