2020-01-30 20:34:45 +01:00
|
|
|
import React from 'react'
|
|
|
|
import assert from 'assert'
|
|
|
|
import sinon from 'sinon'
|
|
|
|
import configureMockStore from 'redux-mock-store'
|
|
|
|
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'
|
|
|
|
import Welcome from '../index'
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Welcome', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const mockStore = {
|
|
|
|
metamask: {},
|
|
|
|
}
|
|
|
|
|
|
|
|
const store = configureMockStore()(mockStore)
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
after(function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
sinon.restore()
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('routes to select action when participateInMetaMetrics is not initialized', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
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')
|
|
|
|
assert.equal(props.history.push.getCall(0).args[0], '/initialize/select-action')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('routes to correct password when participateInMetaMetrics is initialized', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
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')
|
|
|
|
assert.equal(props.history.push.getCall(0).args[0], '/initialize/create-password')
|
|
|
|
})
|
|
|
|
})
|