Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / testing / lib / vitest / mockUseAuthentication.ts
blob7854599395633996109a2a5a623132ecc2c57117
1 import type { PrivateAuthenticationStore } from '@proton/components/containers/app/interface';
2 import * as useAuthenticationModule from '@proton/components/hooks/useAuthentication';
4 export const mockUseAuthentication = (value?: Partial<PrivateAuthenticationStore>) => {
5     const spy = vi.spyOn(useAuthenticationModule, 'default');
6     spy.mockReturnValue({
7         getUID: vi.fn(),
8         setUID: vi.fn(),
9         setLocalID: vi.fn(),
10         getLocalID: vi.fn(),
11         hasSession: vi.fn(),
12         setPassword: vi.fn(),
13         getPassword: vi.fn(),
14         setPersistent: vi.fn(),
15         getPersistent: vi.fn(),
16         setClientKey: vi.fn(),
17         getClientKey: vi.fn(),
18         setOfflineKey: vi.fn(),
19         getOfflineKey: vi.fn(),
20         setTrusted: vi.fn(),
21         getTrusted: vi.fn(),
22         logout: vi.fn(),
23         login: vi.fn(),
24         UID: '',
25         mode: 'sso',
26         localID: '',
27         basename: '',
28         ready: true,
29         ...value,
30     });
31     return spy;