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 SelectAction from '..'
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Selection Action', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
let wrapper
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
isInitialized: false,
|
|
|
|
setFirstTimeFlowType: sinon.spy(),
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
beforeEach(function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
wrapper = mountWithRouter(<SelectAction.WrappedComponent {...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.setFirstTimeFlowType.resetHistory()
|
|
|
|
props.history.push.resetHistory()
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks import wallet to route to import FTF', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const importWalletButton = wrapper
|
|
|
|
.find('.btn-primary.first-time-flow__button')
|
|
|
|
.at(0)
|
2020-01-30 20:34:45 +01:00
|
|
|
importWalletButton.simulate('click')
|
|
|
|
|
|
|
|
assert(props.setFirstTimeFlowType.calledOnce)
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'import')
|
2020-01-30 20:34:45 +01:00
|
|
|
assert(props.history.push.calledOnce)
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks create wallet to route to create FTF ', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const createWalletButton = wrapper
|
|
|
|
.find('.btn-primary.first-time-flow__button')
|
|
|
|
.at(1)
|
2020-01-30 20:34:45 +01:00
|
|
|
createWalletButton.simulate('click')
|
|
|
|
|
|
|
|
assert(props.setFirstTimeFlowType.calledOnce)
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'create')
|
2020-01-30 20:34:45 +01:00
|
|
|
assert(props.history.push.calledOnce)
|
|
|
|
})
|
|
|
|
})
|