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.
62 lines
1.5 KiB
62 lines
1.5 KiB
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 Welcome from './welcome.container';
|
||
5 years ago
|
|
||
4 years ago
|
describe('Welcome', () => {
|
||
5 years ago
|
const mockStore = {
|
||
|
metamask: {},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
const store = configureMockStore()(mockStore);
|
||
5 years ago
|
|
||
4 years ago
|
afterAll(() => {
|
||
4 years ago
|
sinon.restore();
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('routes to select action when participateInMetaMetrics is not initialized', () => {
|
||
5 years ago
|
const props = {
|
||
|
history: {
|
||
|
push: sinon.spy(),
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
|
const wrapper = mountWithRouter(
|
||
4 years ago
|
<Welcome.WrappedComponent {...props} />,
|
||
|
store,
|
||
4 years ago
|
);
|
||
5 years ago
|
|
||
4 years ago
|
const getStartedButton = wrapper.find(
|
||
|
'.btn-primary.first-time-flow__button',
|
||
4 years ago
|
);
|
||
|
getStartedButton.simulate('click');
|
||
4 years ago
|
expect(props.history.push.getCall(0).args[0]).toStrictEqual(
|
||
4 years ago
|
'/initialize/select-action',
|
||
4 years ago
|
);
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('routes to correct password when participateInMetaMetrics is initialized', () => {
|
||
5 years ago
|
const props = {
|
||
|
welcomeScreenSeen: true,
|
||
|
participateInMetaMetrics: false,
|
||
|
history: {
|
||
|
push: sinon.spy(),
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
|
const wrapper = mountWithRouter(
|
||
4 years ago
|
<Welcome.WrappedComponent {...props} />,
|
||
|
store,
|
||
4 years ago
|
);
|
||
5 years ago
|
|
||
4 years ago
|
const getStartedButton = wrapper.find(
|
||
|
'.btn-primary.first-time-flow__button',
|
||
4 years ago
|
);
|
||
|
getStartedButton.simulate('click');
|
||
4 years ago
|
expect(props.history.push.getCall(0).args[0]).toStrictEqual(
|
||
4 years ago
|
'/initialize/create-password',
|
||
4 years ago
|
);
|
||
|
});
|
||
|
});
|