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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user