1 import { useAddressesKeys } from '@proton/account/addressKeys/hooks';
2 import { useAddresses } from '@proton/account/addresses/hooks';
3 import { renderWithProviders } from '@proton/components/containers/contacts/tests/render';
4 import type { Address, UserModel } from '@proton/shared/lib/interfaces';
5 import { ForwardingState, ForwardingType } from '@proton/shared/lib/interfaces';
15 } from '@proton/testing';
17 import OutgoingForwardTable from './OutgoingForwardTable';
19 const OutgoingForwardTableContext = applyHOCs(
26 )(OutgoingForwardTable);
28 jest.mock('@proton/account/addresses/hooks');
29 const mockUseAddresses = useAddresses as jest.MockedFunction<any>;
31 jest.mock('@proton/account/addressKeys/hooks');
32 const mockUserAddressesKeys = useAddressesKeys as jest.MockedFunction<any>;
34 describe('OutgoingForwardTable', () => {
36 const mockAddresses = [{ ID: 'AddressID' } as Address];
37 const mockAddressesKeys = [{}];
39 mockUseAddresses.mockReturnValue([mockAddresses, false]);
40 mockUserAddressesKeys.mockReturnValue(mockAddressesKeys);
47 Email: 'forwarderEmail',
50 const chainedEmails = [''];
51 const user = {} as UserModel;
55 ForwarderAddressID: 'addressID',
56 ForwardeeEmail: 'forwardeeEmail',
57 State: ForwardingState.Active,
59 Type: ForwardingType.InternalEncrypted,
63 const utils = renderWithProviders(
64 <OutgoingForwardTableContext
66 forwardings={forwardings}
68 chainedEmails={chainedEmails}
73 describe('when we display outgoing address forwarding', () => {
74 it('should show forwarder email address', () => {
75 const { getByText } = setup();
76 expect(getByText('forwarderEmail')).toBeInTheDocument();
79 it('should show forwardee email address', () => {
80 const { getByText } = setup();
81 expect(getByText('forwardeeEmail')).toBeInTheDocument();