Skip to content

Commit

Permalink
Update unit tests for address book changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Jul 26, 2019
1 parent ed42223 commit 1bc8e31
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ describe('AddRecipient Component', function () {
updateSendToError={propsMethodSpies.updateSendToError}
updateSendToWarning={propsMethodSpies.updateSendToWarning}
addressBook={[{ address: '0x80F061544cC398520615B5d3e7A3BedD70cd4510', name: 'Fav 5' }]}
nonContacts={[{ address: '0x70F061544cC398520615B5d3e7A3BedD70cd4510', name: 'Fav 7' }]}
contacts={[{ address: '0x60F061544cC398520615B5d3e7A3BedD70cd4510', name: 'Fav 6' }]}
/>, { context: { t: str => str + '_t' } })
instance = wrapper.instance()
})
Expand Down Expand Up @@ -129,6 +131,8 @@ describe('AddRecipient Component', function () {
wrapper.setProps({
addressBook: [],
toError: 'bad',
contacts: [],
nonContacts: [],
})

const dialog = wrapper.find(Dialog)
Expand All @@ -143,6 +147,8 @@ describe('AddRecipient Component', function () {
addressBook: [],
toError: 'bad',
ensResolutionError: 'very bad',
contacts: [],
nonContacts: [],
})

const dialog = wrapper.find(Dialog)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ proxyquire('../add-recipient.container.js', {
accountsWithSendEtherInfoSelector: (s) => `mockAccountsWithSendEtherInfoSelector:${s}`,
},
'../../../../selectors/selectors': {
getAddressBook: (s) => `mockAddressBook:${s}`,
getAddressBook: (s) => [{ name: `mockAddressBook:${s}` }],
getAddressBookEntry: (s) => `mockAddressBookEntry:${s}`,
},
'../../../../store/actions': actionSpies,
})
Expand All @@ -34,10 +35,13 @@ describe('add-recipient container', () => {

it('should map the correct properties to props', () => {
assert.deepEqual(mapStateToProps('mockState'), {
addressBook: 'mockAddressBook:mockState',
addressBook: [{ name: 'mockAddressBook:mockState' }],
contacts: [{ name: 'mockAddressBook:mockState' }],
ensResolution: 'mockSendEnsResolution:mockState',
ensResolutionError: 'mockSendEnsResolutionError:mockState',
ownedAccounts: 'mockAccountsWithSendEtherInfoSelector:mockState',
addressBookEntryName: undefined,
nonContacts: [],
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('SendContent Component', function () {
it('should not render the asset dropdown if token length is 0 ', () => {
wrapper.setProps({ tokens: [] })
const PageContainerContentChild = wrapper.find(PageContainerContent).children()
assert(PageContainerContentChild.childAt(2).is(SendAssetRow))
assert(PageContainerContentChild.childAt(2).find('send-v2__asset-dropdown__single-asset'), true)
assert(PageContainerContentChild.childAt(1).is(SendAssetRow))
assert(PageContainerContentChild.childAt(1).find('send-v2__asset-dropdown__single-asset'), true)
})
})
2 changes: 2 additions & 0 deletions ui/app/pages/send/tests/send-component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const propsMethodSpies = {
resetSendState: sinon.spy(),
fetchBasicGasEstimates: sinon.stub().returns(Promise.resolve(mockBasicGasEstimates)),
fetchGasEstimates: sinon.spy(),
updateToNicknameIfNecessary: sinon.spy(),
}
const utilsMethodStubs = {
getAmountErrorObject: sinon.stub().returns({ amount: 'mockAmountError' }),
Expand Down Expand Up @@ -64,6 +65,7 @@ describe('Send Component', function () {
updateSendErrors={propsMethodSpies.updateSendErrors}
updateSendTokenBalance={propsMethodSpies.updateSendTokenBalance}
resetSendState={propsMethodSpies.resetSendState}
updateToNicknameIfNecessary={propsMethodSpies.updateToNicknameIfNecessary}
/>)
})

Expand Down
2 changes: 2 additions & 0 deletions ui/app/pages/send/tests/send-container.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ proxyquire('../send.container.js', {
getTokens: s => `mockTokens:${s}`,
},
'../../selectors/selectors': {
getAddressBook: (s) => `mockAddressBook:${s}`,
getSelectedAddress: (s) => `mockSelectedAddress:${s}`,
},
'../../store/actions': actionSpies,
Expand Down Expand Up @@ -93,6 +94,7 @@ describe('send container', () => {
ensResolution: 'mockSendEnsResolution:mockState',
ensResolutionError: 'mockSendEnsResolutionError:mockState',
toNickname: 'mockToNickname:mockState',
addressBook: 'mockAddressBook:mockState',
})
})

Expand Down

0 comments on commit 1bc8e31

Please sign in to comment.