diff --git a/src/components/savedAccounts/savedAccounts.js b/src/components/savedAccounts/savedAccounts.js index 119882761..397649521 100644 --- a/src/components/savedAccounts/savedAccounts.js +++ b/src/components/savedAccounts/savedAccounts.js @@ -60,7 +60,7 @@ const SavedAccounts = ({ {account.network === networks.customNode.code ? account.address : - t((getNetwork(account.network) || {}).name)} + t(getNetwork(account.network).name)} { +describe.only('SavedAccounts', () => { let wrapper; let closeDialogSpy; let accountSavedSpy; + const publicKey = 'fab9d261ea050b9e326d7e11587eccc343a20e64e29d8781b50fd06683cacc88'; + const savedAccounts = [ + { + publicKey: 'hab9d261ea050b9e326d7e11587eccc343a20e64e29d8781b50fd06683cacc88', + network: 0, + }, + { + network: 2, + publicKey, + address: 'http://localhost:4000', + }, + { + network: 0, + publicKey, + }, + ]; const props = { - account: { - publicKey: 'fab9d261ea050b9e326d7e11587eccc343a20e64e29d8781b50fd06683cacc88', - }, closeDialog: () => {}, accountSaved: () => {}, accountRemoved: () => {}, accountSwitched: () => {}, - networkOptions: {}, - publicKey: [], + networkOptions: { + code: 0, + }, + publicKey, savedAccounts: [], t: key => key, }; @@ -59,5 +74,19 @@ describe('SavedAccounts', () => { const componentProps = wrapper.find(SavedAccounts).props(); expect(componentProps.accountSaved).to.have.been.calledWith(); }); + + it('should render InfoParagraph', () => { + wrapper.find('button.add-active-account-button').simulate('click'); + expect(wrapper.find('InfoParagraph')).to.have.lengthOf(1); + }); + + it('should render savedAccounts.length table rows', () => { + wrapper.find('button.add-active-account-button').simulate('click'); + wrapper.setProps({ + ...props, + savedAccounts, + }); + expect(wrapper.find('TableRow')).to.have.lengthOf(savedAccounts.length); + }); });