mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
101fe0b27a
* 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
62 lines
1.5 KiB
JavaScript
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',
|
|
);
|
|
});
|
|
});
|