aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js')
-rw-r--r--ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js
index 8d4f26e15..f6abb26e6 100644
--- a/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js
+++ b/ui/app/components/send/send-content/send-to-row/tests/send-to-row-utils.test.js
@@ -19,6 +19,7 @@ const toRowUtils = proxyquire('../send-to-row.utils.js', {
})
const {
getToErrorObject,
+ getToWarningObject,
} = toRowUtils
describe('send-to-row utils', () => {
@@ -78,4 +79,29 @@ describe('send-to-row utils', () => {
})
})
+ describe('getToWarningObject()', () => {
+ it('should return a known address recipient if to is truthy but part of state tokens', () => {
+ assert.deepEqual(getToWarningObject('0xabc123', undefined, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
+ to: KNOWN_RECIPIENT_ADDRESS_ERROR,
+ })
+ })
+
+ it('should null if to is truthy part of tokens but selectedToken falsy', () => {
+ assert.deepEqual(getToWarningObject('0xabc123', undefined, [{'address': '0xabc123'}]), {
+ to: null,
+ })
+ })
+
+ it('should return a known address recipient if to is truthy but part of contract metadata', () => {
+ assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
+ to: KNOWN_RECIPIENT_ADDRESS_ERROR,
+ })
+ })
+ it('should null if to is truthy part of contract metadata but selectedToken falsy', () => {
+ assert.deepEqual(getToWarningObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, [{'address': '0xabc123'}], {'address': '0xabc123'}), {
+ to: KNOWN_RECIPIENT_ADDRESS_ERROR,
+ })
+ })
+ })
+
})