Merge branch 'renovate/all-minor-patch' into 'main'
[ProtonMail-WebClient.git] / packages / testing / lib / vitest / mockUseOrganization.ts
blobcc83796077e010be52423b25405544e6b99a0f26
1 import * as useOrganizationModule from '@proton/account/organization/hooks';
2 import type { OrganizationWithSettings } from '@proton/shared/lib/interfaces';
4 export const mockUseGetOrganization = (value: Partial<OrganizationWithSettings> = {}) => {
5     const spy = vi.spyOn(useOrganizationModule, 'useGetOrganization');
6     spy.mockReturnValue(
7         vi.fn(
8             async () =>
9                 ({
10                     Name: '',
11                     DisplayName: '',
12                     PlanName: 'bundle2022',
13                     PlanFlags: 7,
14                     TwoFactorRequired: 0,
15                     TwoFactorGracePeriod: null,
16                     Theme: null,
17                     Email: null,
18                     Note: 0,
19                     MaxDomains: 3,
20                     MaxAddresses: 15,
21                     MaxCalendars: 25,
22                     MaxSpace: 536870912000,
23                     MaxMembers: 1,
24                     MaxVPN: 10,
25                     MaxAI: 0,
26                     Features: 1,
27                     Flags: 0,
28                     CreateTime: 1676033386,
29                     LoyaltyCounter: 0,
30                     LoyaltyIncrementTime: 1707569386,
31                     BonusDomains: 0,
32                     BonusAddresses: 0,
33                     BonusSpace: 0,
34                     BonusMembers: 0,
35                     BonusVPN: 0,
36                     UsedDomains: 0,
37                     UsedAddresses: 0,
38                     UsedCalendars: 0,
39                     UsedSpace: 464014,
40                     AssignedSpace: 536870912000,
41                     UsedMembers: 1,
42                     UsedVPN: 10,
43                     UsedAI: 0,
44                     HasKeys: 0,
45                     ToMigrate: 0,
46                     BrokenSKL: 0,
47                     Settings: {
48                         ShowName: true,
49                         LogoID: null,
50                     },
51                     ...value,
52                 }) as OrganizationWithSettings
53         )
54     );
55     return spy;