A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.te...

46 lines
1.4 KiB

import React from 'react';
import { fireEvent, waitFor } from '@testing-library/react';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import MetaMetricsOptIn from '.';
describe('MetaMetrics Opt In', () => {
const props = {
setParticipateInMetaMetrics: jest.fn().mockResolvedValue(),
hideModal: jest.fn(),
participateInMetaMetrics: null,
};
it('should match snapshot', () => {
const { container } = renderWithProvider(
<MetaMetricsOptIn.WrappedComponent />,
);
expect(container).toMatchSnapshot();
});
it('passes false to setParticipateInMetaMetrics and hides modal', async () => {
const { queryByText } = renderWithProvider(
<MetaMetricsOptIn.WrappedComponent {...props} />,
);
fireEvent.click(queryByText('[noThanks]'));
await waitFor(() => {
expect(props.setParticipateInMetaMetrics).toHaveBeenCalledWith(false);
expect(props.hideModal).toHaveBeenCalled();
});
});
it('passes true to setParticipateInMetaMetrics and hides modal', async () => {
const { queryByText } = renderWithProvider(
<MetaMetricsOptIn.WrappedComponent {...props} />,
);
fireEvent.click(queryByText('[affirmAgree]'));
await waitFor(() => {
expect(props.setParticipateInMetaMetrics).toHaveBeenCalledWith(true);
expect(props.hideModal).toHaveBeenCalled();
});
});
});