2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import configureMockStore from 'redux-mock-store';
|
|
|
|
import { mountWithRouter } from '../../../../../../test/lib/render-helpers';
|
|
|
|
import MetaMetricsOptIn from '..';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('MetaMetricsOptIn', function () {
|
|
|
|
it('opt out of MetaMetrics', function () {
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
setParticipateInMetaMetrics: sinon.stub().resolves(),
|
|
|
|
participateInMetaMetrics: false,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-11 17:51:13 +01:00
|
|
|
const store = configureMockStore()({
|
|
|
|
metamask: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-02-11 17:51:13 +01:00
|
|
|
const wrapper = mountWithRouter(
|
2020-11-03 00:41:28 +01:00
|
|
|
<MetaMetricsOptIn.WrappedComponent {...props} />,
|
|
|
|
store,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-11-03 00:41:28 +01:00
|
|
|
const noThanksButton = wrapper.find(
|
|
|
|
'.btn-default.page-container__footer-button',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
noThanksButton.simulate('click');
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.ok(props.setParticipateInMetaMetrics.calledOnceWithExactly(false));
|
|
|
|
props.setParticipateInMetaMetrics.resetHistory();
|
|
|
|
});
|
|
|
|
});
|