1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/ui/pages/first-time-flow/welcome/welcome.test.js
Dan J Miller 101fe0b27a
Metrics adjustments (#15313)
* Don't send errors to sentry if users have not opted-in to participate in metametrics

* Don't capture opt-out metrics

* Move the metrics-opt in screen to immediately after the welcome screen

* Ensure that global.getSentryState is set in the background

* Fix e2e tests after rearranging onboardin flow

* Fix unit tests

* More e2e test fixes

* Remove unnecessary wrappers around capture exception
2022-07-22 18:09:48 -02:30

62 lines
1.5 KiB
JavaScript

import React from 'react';
import sinon from 'sinon';
import configureMockStore from 'redux-mock-store';
import { mountWithRouter } from '../../../../test/lib/render-helpers';
import Welcome from './welcome.container';
describe('Welcome', () => {
const mockStore = {
metamask: {},
};
const store = configureMockStore()(mockStore);
afterAll(() => {
sinon.restore();
});
it('routes to the metametrics screen when participateInMetaMetrics is not initialized', () => {
const props = {
history: {
push: sinon.spy(),
},
};
const wrapper = mountWithRouter(
<Welcome.WrappedComponent {...props} />,
store,
);
const getStartedButton = wrapper.find(
'.btn-primary.first-time-flow__button',
);
getStartedButton.simulate('click');
expect(props.history.push.getCall(0).args[0]).toStrictEqual(
'/initialize/metametrics-opt-in',
);
});
it('routes to select action when participateInMetaMetrics is initialized', () => {
const props = {
welcomeScreenSeen: true,
participateInMetaMetrics: false,
history: {
push: sinon.spy(),
},
};
const wrapper = mountWithRouter(
<Welcome.WrappedComponent {...props} />,
store,
);
const getStartedButton = wrapper.find(
'.btn-primary.first-time-flow__button',
);
getStartedButton.simulate('click');
expect(props.history.push.getCall(0).args[0]).toStrictEqual(
'/initialize/select-action',
);
});
});