1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-04 23:14:56 +01:00
metamask-extension/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import RevealSeedPhrase from '..'
describe('Reveal Seed Phrase', function () {
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'
const props = {
history: {
push: sinon.spy(),
},
seedPhrase: TEST_SEED,
setSeedPhraseBackedUp: sinon.spy(),
setCompletedOnboarding: sinon.spy(),
}
beforeEach(function () {
2020-11-03 00:41:28 +01:00
wrapper = mount(<RevealSeedPhrase.WrappedComponent {...props} />, {
context: {
t: (str) => str,
metricsEvent: () => undefined,
},
2020-11-03 00:41:28 +01:00
})
})
it('seed phrase', function () {
const seedPhrase = wrapper.find('.reveal-seed-phrase__secret-words--hidden')
assert.strictEqual(seedPhrase.length, 1)
assert.strictEqual(seedPhrase.text(), TEST_SEED)
})
it('clicks to reveal', function () {
const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker')
assert.strictEqual(wrapper.state().isShowingSeedPhrase, false)
reveal.simulate('click')
assert.strictEqual(wrapper.state().isShowingSeedPhrase, true)
const showSeed = wrapper.find('.reveal-seed-phrase__secret-words')
assert.strictEqual(showSeed.length, 1)
})
})