aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-11 14:37:33 +0800
committerDan <danjm.com@gmail.com>2018-05-11 14:37:33 +0800
commit5d79d126484a25ed6ad7f07c779ba91900abae7c (patch)
tree6c87097c14a58beacf1bbb6dcab6f8e4785874b3 /ui
parent22e2806ae22548c78f94c90e11597a823351d80f (diff)
downloadtangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar.gz
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar.bz2
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar.lz
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar.xz
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.tar.zst
tangerine-wallet-browser-5d79d126484a25ed6ad7f07c779ba91900abae7c.zip
SendRowErrorMessage component test.
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js
new file mode 100644
index 000000000..2304a43d2
--- /dev/null
+++ b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js
@@ -0,0 +1,28 @@
+import React from 'react'
+import assert from 'assert'
+import { shallow } from 'enzyme'
+import SendRowErrorMessage from '../send-row-error-message.component.js'
+
+describe('SendRowErrorMessage Component', function () {
+ let wrapper
+
+ beforeEach(() => {
+ wrapper = shallow(<SendRowErrorMessage
+ errors={{ error1: 'abc', error2: 'def' }}
+ errorType={'error3'}
+ />, { context: { t: str => str + '_t' } })
+ })
+
+ describe('render', () => {
+ it('should render null if the passed errors do not contain an error of errorType', () => {
+ assert.equal(wrapper.find('.send-v2__error').length, 0)
+ assert.equal(wrapper.html(), null)
+ })
+
+ it('should render an error message if the passed errors contain an error of errorType', () => {
+ wrapper.setProps({ errors: { error1: 'abc', error2: 'def', error3: 'xyz' } })
+ assert.equal(wrapper.find('.send-v2__error').length, 1)
+ assert.equal(wrapper.find('.send-v2__error').text(), 'xyz_t')
+ })
+ })
+})