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'
|
|
|
|
import { DEFAULT_ROUTE } from '../../../../helpers/constants/routes'
|
2020-08-19 18:27:05 +02:00
|
|
|
import EndOfFlowScreen from '..'
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('End of Flow Screen', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
let wrapper
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
beforeEach(function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
wrapper = mountWithRouter(
|
2020-07-14 17:20:41 +02:00
|
|
|
<EndOfFlowScreen.WrappedComponent {...props} />,
|
2020-01-30 20:34:45 +01:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('renders', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
assert.equal(wrapper.length, 1)
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should navigate to the default route on click', function (done) {
|
2020-01-30 20:34:45 +01:00
|
|
|
const endOfFlowButton = wrapper.find('.btn-primary.first-time-flow__button')
|
|
|
|
endOfFlowButton.simulate('click')
|
|
|
|
|
|
|
|
setImmediate(() => {
|
2020-02-11 17:51:13 +01:00
|
|
|
assert(props.history.push.calledOnceWithExactly(DEFAULT_ROUTE))
|
2020-01-30 20:34:45 +01:00
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|