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.
34 lines
989 B
34 lines
989 B
4 years ago
|
import React from 'react';
|
||
|
import sinon from 'sinon';
|
||
|
import configureMockStore from 'redux-mock-store';
|
||
4 years ago
|
import { mountWithRouter } from '../../../../test/lib/render-helpers';
|
||
4 years ago
|
import MetaMetricsOptIn from './metametrics-opt-in.container';
|
||
5 years ago
|
|
||
4 years ago
|
describe('MetaMetricsOptIn', () => {
|
||
|
it('opt out of MetaMetrics', () => {
|
||
5 years ago
|
const props = {
|
||
|
history: {
|
||
|
push: sinon.spy(),
|
||
|
},
|
||
|
setParticipateInMetaMetrics: sinon.stub().resolves(),
|
||
|
participateInMetaMetrics: false,
|
||
4 years ago
|
};
|
||
5 years ago
|
const store = configureMockStore()({
|
||
|
metamask: {},
|
||
4 years ago
|
});
|
||
5 years ago
|
const wrapper = mountWithRouter(
|
||
4 years ago
|
<MetaMetricsOptIn.WrappedComponent {...props} />,
|
||
|
store,
|
||
4 years ago
|
);
|
||
4 years ago
|
const noThanksButton = wrapper.find(
|
||
|
'.btn-default.page-container__footer-button',
|
||
4 years ago
|
);
|
||
|
noThanksButton.simulate('click');
|
||
5 years ago
|
|
||
4 years ago
|
expect(
|
||
|
props.setParticipateInMetaMetrics.calledOnceWithExactly(false),
|
||
|
).toStrictEqual(true);
|
||
4 years ago
|
props.setParticipateInMetaMetrics.resetHistory();
|
||
|
});
|
||
|
});
|