1 import { fireEvent, render } from '@testing-library/react';
3 import { updatePromptPin } from '@proton/shared/lib/api/mailSettings';
13 } from '@proton/testing';
15 import PromptPinToggle from './PromptPinToggle';
17 const PromptPinToggleContext = applyHOCs(withApi(), withEventManager(), withNotifications())(PromptPinToggle);
19 describe('PromptPinToggle', () => {
20 let mockedApi: jest.Mock;
21 let mockedCall: jest.Mock;
24 mockedApi = jest.fn();
25 mockedCall = jest.fn();
27 mockUseApi(mockedApi);
28 mockUseEventManager({ call: mockedCall });
30 mockUseMailSettings();
31 mockUseNotifications();
35 const utils = render(<PromptPinToggleContext />);
41 describe('when we toggle the component', () => {
42 it('should call the API', () => {
43 const { getByRole } = setup();
44 const toggle = getByRole('checkbox');
45 fireEvent.click(toggle);
46 expect(mockedApi).toHaveBeenCalledWith(updatePromptPin(1));