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 { mount } from 'enzyme'
|
2020-08-19 18:27:05 +02:00
|
|
|
import RevealSeedPhrase from '..'
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Reveal Seed Phrase', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
let wrapper
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const TEST_SEED =
|
|
|
|
'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
|
|
|
seedPhrase: TEST_SEED,
|
|
|
|
setSeedPhraseBackedUp: sinon.spy(),
|
|
|
|
setCompletedOnboarding: sinon.spy(),
|
|
|
|
}
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
beforeEach(function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
wrapper = mount(<RevealSeedPhrase.WrappedComponent {...props} />, {
|
|
|
|
context: {
|
|
|
|
t: (str) => str,
|
|
|
|
metricsEvent: () => undefined,
|
2020-07-14 17:20:41 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
})
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('seed phrase', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const seedPhrase = wrapper.find('.reveal-seed-phrase__secret-words--hidden')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(seedPhrase.length, 1)
|
|
|
|
assert.strictEqual(seedPhrase.text(), TEST_SEED)
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks to reveal', function () {
|
2020-01-30 20:34:45 +01:00
|
|
|
const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker')
|
|
|
|
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(wrapper.state().isShowingSeedPhrase, false)
|
2020-01-30 20:34:45 +01:00
|
|
|
reveal.simulate('click')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(wrapper.state().isShowingSeedPhrase, true)
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
const showSeed = wrapper.find('.reveal-seed-phrase__secret-words')
|
2020-12-03 16:46:22 +01:00
|
|
|
assert.strictEqual(showSeed.length, 1)
|
2020-01-30 20:34:45 +01:00
|
|
|
})
|
|
|
|
})
|