From f3bcfacd8a4a7a375ae2ef4e40d7991a86ebd77f Mon Sep 17 00:00:00 2001 From: Renato Massao Yonamine Date: Thu, 10 Jan 2019 16:29:54 +0100 Subject: [PATCH] :white_check_mark: Add test to accountCreated step --- .../registerV2/accountCreated.test.js | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/components/registerV2/accountCreated.test.js diff --git a/src/components/registerV2/accountCreated.test.js b/src/components/registerV2/accountCreated.test.js new file mode 100644 index 0000000000..94ebe0c55e --- /dev/null +++ b/src/components/registerV2/accountCreated.test.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { expect } from 'chai'; +import { mount } from 'enzyme'; +import { MemoryRouter } from 'react-router-dom'; +import i18n from '../../i18n'; +import { generatePassphrase } from '../../utils/passphrase'; +import { extractAddress } from '../../utils/account'; +import AccountCreated from './accountCreated'; + +describe('V2 Register Process - Account created', () => { + let wrapper; + + const crypotObj = window.crypto || window.msCrypto; + const passphrase = generatePassphrase({ + seed: [...crypotObj.getRandomValues(new Uint16Array(16))].map(x => (`00${(x % 256).toString(16)}`).slice(-2)), + }); + const account = { + address: extractAddress(passphrase), + passphrase, + }; + + const options = { + context: { i18n }, + childContextTypes: { + i18n: PropTypes.object.isRequired, + }, + }; + + const props = { + account, + }; + + beforeEach(() => { + wrapper = mount( + + , options); + }); + + it('Should render with correct avatar and address', () => { + expect(wrapper.find('AccountVisual')).to.have.length(1); + expect(wrapper.find('AccountVisual').prop('address')).to.have.equal(account.address); + expect(wrapper.find('.address').text()).to.be.equal(account.address); + }); +});