2020-01-30 20:34:45 +01:00
|
|
|
import assert from 'assert'
|
2020-08-18 21:18:25 +02:00
|
|
|
import React from 'react'
|
2020-01-30 20:34:45 +01:00
|
|
|
import sinon from 'sinon'
|
|
|
|
import { mountWithRouter } from '../../../../../test/lib/render-helpers'
|
2020-08-19 18:27:05 +02:00
|
|
|
import CreateAccountPage from '..'
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Create Account Page', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
let wrapper
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
location: {
|
|
|
|
pathname: '/new-account',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
before(function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
wrapper = mountWithRouter(<CreateAccountPage {...props} />)
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
afterEach(function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
props.history.push.resetHistory()
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks create account and routes to new-account path', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const createAccount = wrapper.find('.new-account__tabs__tab').at(0)
|
|
|
|
createAccount.simulate('click')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(props.history.push.getCall(0).args[0], '/new-account')
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks import account and routes to import new account path', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const importAccount = wrapper.find('.new-account__tabs__tab').at(1)
|
|
|
|
importAccount.simulate('click')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(
|
|
|
|
props.history.push.getCall(0).args[0],
|
|
|
|
'/new-account/import',
|
|
|
|
)
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks connect HD Wallet and routes to connect new account path', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const connectHdWallet = wrapper.find('.new-account__tabs__tab').at(2)
|
|
|
|
connectHdWallet.simulate('click')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(
|
|
|
|
props.history.push.getCall(0).args[0],
|
|
|
|
'/new-account/connect',
|
|
|
|
)
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
})
|