Skip to content

Commit

Permalink
Remove KNOWN_ADDRESS_ERROR from error objects (#6578)
Browse files Browse the repository at this point in the history
* Remove KNOWN_ADDRESS_ERROR from error objects

* Update test comments
  • Loading branch information
chikeichan authored May 8, 2019
1 parent 7df7f70 commit 0497d20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ function getToErrorObject (to, toError = null, hasHexData = false, tokens = [],
}
} else if (!isValidAddress(to, network) && !toError) {
toError = isEthNetwork(network) ? INVALID_RECIPIENT_ADDRESS_ERROR : INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR
} else if (selectedToken && (ethUtil.toChecksumAddress(to) in contractMap || checkExistingAddresses(to, tokens))) {
toError = KNOWN_RECIPIENT_ADDRESS_ERROR
}

return { to: toError }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('send-to-row utils', () => {
})
})

it('should return a known address recipient if to is truthy but part of state tokens', () => {
it('should return null if to is truthy but part of state tokens', () => {
assert.deepEqual(getToErrorObject('0xabc123', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
to: KNOWN_RECIPIENT_ADDRESS_ERROR,
to: null,
})
})

Expand All @@ -67,14 +67,14 @@ describe('send-to-row utils', () => {
})
})

it('should return a known address recipient if to is truthy but part of contract metadata', () => {
it('should return null if to is truthy but part of contract metadata', () => {
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
to: KNOWN_RECIPIENT_ADDRESS_ERROR,
to: null,
})
})
it('should null if to is truthy part of contract metadata but selectedToken falsy', () => {
assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
to: KNOWN_RECIPIENT_ADDRESS_ERROR,
to: null,
})
})
})
Expand Down

0 comments on commit 0497d20

Please sign in to comment.