aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-footer/tests
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-26 01:09:31 +0800
committerDan <danjm.com@gmail.com>2018-05-26 01:09:31 +0800
commite712336189e1a0a453ea30dbb58abbc3c57db8f8 (patch)
tree13137b391037515880ebd227a293ea75dfa1bbe8 /ui/app/components/send_/send-footer/tests
parent0de765aa25637cd85e22eebd11b6c4c8a32faf14 (diff)
downloadtangerine-wallet-browser-e712336189e1a0a453ea30dbb58abbc3c57db8f8.tar.gz
tangerine-wallet-browser-e712336189e1a0a453ea30dbb58abbc3c57db8f8.tar.zst
tangerine-wallet-browser-e712336189e1a0a453ea30dbb58abbc3c57db8f8.zip
Send refactor: fix error handling and form disabling in send form.
Diffstat (limited to 'ui/app/components/send_/send-footer/tests')
-rw-r--r--ui/app/components/send_/send-footer/tests/send-footer-component.test.js6
-rw-r--r--ui/app/components/send_/send-footer/tests/send-footer-container.test.js3
-rw-r--r--ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js24
3 files changed, 31 insertions, 2 deletions
diff --git a/ui/app/components/send_/send-footer/tests/send-footer-component.test.js b/ui/app/components/send_/send-footer/tests/send-footer-component.test.js
index a74b6195c..e071fe54f 100644
--- a/ui/app/components/send_/send-footer/tests/send-footer-component.test.js
+++ b/ui/app/components/send_/send-footer/tests/send-footer-component.test.js
@@ -86,6 +86,12 @@ describe('SendFooter Component', function () {
gasTotal: false,
expectedResult: true,
},
+ 'should return true if to is truthy': {
+ to: '0xsomevalidAddress',
+ inError: false,
+ gasTotal: false,
+ expectedResult: true,
+ },
'should return true if selectedToken is truthy and tokenBalance is falsy': {
selectedToken: true,
tokenBalance: null,
diff --git a/ui/app/components/send_/send-footer/tests/send-footer-container.test.js b/ui/app/components/send_/send-footer/tests/send-footer-container.test.js
index 9a616777e..39d6a7686 100644
--- a/ui/app/components/send_/send-footer/tests/send-footer-container.test.js
+++ b/ui/app/components/send_/send-footer/tests/send-footer-container.test.js
@@ -39,9 +39,8 @@ proxyquire('../send-footer.container.js', {
getSendToAccounts: (s) => `mockToAccounts:${s}`,
getTokenBalance: (s) => `mockTokenBalance:${s}`,
getUnapprovedTxs: (s) => `mockUnapprovedTxs:${s}`,
- isSendFormInError: (s) => `mockInError:${s}`,
},
- './send-footer.selectors': { isSendFormInError: () => {} },
+ './send-footer.selectors': { isSendFormInError: (s) => `mockInError:${s}` },
'./send-footer.utils': utilsStubs,
})
diff --git a/ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js b/ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js
new file mode 100644
index 000000000..8de032f57
--- /dev/null
+++ b/ui/app/components/send_/send-footer/tests/send-footer-selectors.test.js
@@ -0,0 +1,24 @@
+import assert from 'assert'
+import proxyquire from 'proxyquire'
+
+const {
+ isSendFormInError,
+} = proxyquire('../send-footer.selectors', {
+ '../send.selectors': {
+ getSendErrors: (mockState) => mockState.errors,
+ },
+})
+
+describe('send-footer selectors', () => {
+
+ describe('getTitleKey()', () => {
+ it('should return true if any of the values of the object returned by getSendErrors are truthy', () => {
+ assert.equal(isSendFormInError({ errors: { a: 'abc', b: false} }), true)
+ })
+
+ it('should return false if all of the values of the object returned by getSendErrors are falsy', () => {
+ assert.equal(isSendFormInError({ errors: { a: false, b: null} }), false)
+ })
+ })
+
+})