1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-11 20:27:12 +01:00
metamask-extension/ui/pages/first-time-flow/seed-phrase/reveal-seed-phrase/reveal-seed-phrase.test.js
2022-03-29 08:46:24 -05:00

49 lines
1.3 KiB
JavaScript

import React from 'react';
import sinon from 'sinon';
import { mount } from 'enzyme';
import RevealSeedPhrase from './reveal-seed-phrase.container';
describe('Reveal Secret Recovery Phrase', () => {
let wrapper;
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(() => {
wrapper = mount(<RevealSeedPhrase.WrappedComponent {...props} />, {
context: {
t: (str) => str,
trackEvent: () => undefined,
},
});
});
it('secret recovery phrase', () => {
const seedPhrase = wrapper.find(
'.reveal-seed-phrase__secret-words--hidden',
);
expect(seedPhrase).toHaveLength(1);
expect(seedPhrase.text()).toStrictEqual(TEST_SEED);
});
it('clicks to reveal', () => {
const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker');
expect(wrapper.state().isShowingSeedPhrase).toStrictEqual(false);
reveal.simulate('click');
expect(wrapper.state().isShowingSeedPhrase).toStrictEqual(true);
const showSeed = wrapper.find('.reveal-seed-phrase__secret-words');
expect(showSeed).toHaveLength(1);
});
});