2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import { mount } from 'enzyme';
|
2021-03-16 22:00:08 +01:00
|
|
|
import RevealSeedPhrase from './reveal-seed-phrase.container';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Reveal Seed Phrase', () => {
|
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
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
beforeEach(() => {
|
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
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('seed phrase', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const seedPhrase = wrapper.find(
|
|
|
|
'.reveal-seed-phrase__secret-words--hidden',
|
|
|
|
);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(seedPhrase).toHaveLength(1);
|
|
|
|
expect(seedPhrase.text()).toStrictEqual(TEST_SEED);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('clicks to reveal', () => {
|
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-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.state().isShowingSeedPhrase).toStrictEqual(false);
|
2021-02-04 19:15:23 +01:00
|
|
|
reveal.simulate('click');
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(wrapper.state().isShowingSeedPhrase).toStrictEqual(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');
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(showSeed).toHaveLength(1);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|