Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / packages / testing / lib / mockUseAddresses.ts
blobf77b1db3462b6c7b932ff7be7352845685718a31
1 import * as useAddressesModule from '@proton/account/addresses/hooks';
2 import type { Address } from '@proton/shared/lib/interfaces';
4 import { buildAddress } from '../builders/address';
6 export const mockUseAddresses = (value: [Address[]?, boolean?] = []) => {
7     const [addresses, cached = false] = value;
8     const mockedUseAddress = jest.spyOn(useAddressesModule, 'useAddresses');
9     mockedUseAddress.mockReturnValue([addresses ?? [buildAddress()], Boolean(cached)]);
10     return mockedUseAddress;