1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 20:05:27 +02:00
metamask-extension/ui/app/pages/first-time-flow/select-action/tests/select-action.test.js
Whymarrh Whitby 4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30

47 lines
1.3 KiB
JavaScript

import React from 'react'
import assert from 'assert'
import sinon from 'sinon'
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'
import SelectAction from '../index'
describe('Selection Action', function () {
let wrapper
const props = {
isInitialized: false,
setFirstTimeFlowType: sinon.spy(),
history: {
push: sinon.spy(),
},
}
beforeEach(function () {
wrapper = mountWithRouter(
<SelectAction.WrappedComponent {...props} />
)
})
afterEach(function () {
props.setFirstTimeFlowType.resetHistory()
props.history.push.resetHistory()
})
it('clicks import wallet to route to import FTF', function () {
const importWalletButton = wrapper.find('.btn-primary.first-time-flow__button').at(0)
importWalletButton.simulate('click')
assert(props.setFirstTimeFlowType.calledOnce)
assert.equal(props.setFirstTimeFlowType.getCall(0).args[0], 'import')
assert(props.history.push.calledOnce)
})
it('clicks create wallet to route to create FTF ', function () {
const createWalletButton = wrapper.find('.btn-primary.first-time-flow__button').at(1)
createWalletButton.simulate('click')
assert(props.setFirstTimeFlowType.calledOnce)
assert.equal(props.setFirstTimeFlowType.getCall(0).args[0], 'create')
assert(props.history.push.calledOnce)
})
})