mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 14:15:06 +01:00
34 lines
991 B
JavaScript
34 lines
991 B
JavaScript
import React from 'react';
|
|
import sinon from 'sinon';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import { mountWithRouter } from '../../../../test/lib/render-helpers';
|
|
import MetaMetricsOptIn from './metametrics-opt-in.container';
|
|
|
|
describe('MetaMetricsOptIn', () => {
|
|
it('opt out of MetaMetrics', () => {
|
|
const props = {
|
|
history: {
|
|
push: sinon.spy(),
|
|
},
|
|
setParticipateInMetaMetrics: sinon.stub().resolves(),
|
|
participateInMetaMetrics: false,
|
|
};
|
|
const store = configureMockStore()({
|
|
metamask: {},
|
|
});
|
|
const wrapper = mountWithRouter(
|
|
<MetaMetricsOptIn.WrappedComponent {...props} />,
|
|
store,
|
|
);
|
|
const noThanksButton = wrapper.find(
|
|
'.btn-secondary.page-container__footer-button',
|
|
);
|
|
noThanksButton.simulate('click');
|
|
|
|
expect(
|
|
props.setParticipateInMetaMetrics.calledOnceWithExactly(false),
|
|
).toStrictEqual(true);
|
|
props.setParticipateInMetaMetrics.resetHistory();
|
|
});
|
|
});
|