2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import RevealSeedPhrase from '..';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Reveal Seed Phrase', function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
let wrapper;
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const TEST_SEED =
|
2021-02-04 19:15:23 +01:00
|
|
|
'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(),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-01-30 20:34:45 +01:00
|
|
|
|
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
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('seed phrase', function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
const seedPhrase = wrapper.find(
|
|
|
|
'.reveal-seed-phrase__secret-words--hidden',
|
|
|
|
);
|
|
|
|
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 () {
|
2021-02-04 19:15:23 +01:00
|
|
|
const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker');
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.strictEqual(wrapper.state().isShowingSeedPhrase, false);
|
|
|
|
reveal.simulate('click');
|
|
|
|
assert.strictEqual(wrapper.state().isShowingSeedPhrase, true);
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const showSeed = wrapper.find('.reveal-seed-phrase__secret-words');
|
|
|
|
assert.strictEqual(showSeed.length, 1);
|
|
|
|
});
|
|
|
|
});
|