aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-header/tests/send-header-selectors.test.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-04 02:21:17 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-04 02:21:17 +0800
commit595447ccac0c6d178d63850d45f0ad5456964e4f (patch)
tree61b83e1ba63615351da8e4c2dc7b446353411c9d /ui/app/components/send_/send-header/tests/send-header-selectors.test.js
parent11736e6318182ab5b43430410a46059e5f46ad52 (diff)
parent2e9bd7e9d101287b4466475561df9131f0ef56a6 (diff)
downloadtangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.tar.gz
tangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.tar.zst
tangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.zip
Merge remote-tracking branch 'upstream/develop' into HEAD
Diffstat (limited to 'ui/app/components/send_/send-header/tests/send-header-selectors.test.js')
-rw-r--r--ui/app/components/send_/send-header/tests/send-header-selectors.test.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-header/tests/send-header-selectors.test.js b/ui/app/components/send_/send-header/tests/send-header-selectors.test.js
new file mode 100644
index 000000000..e0c6a3ab3
--- /dev/null
+++ b/ui/app/components/send_/send-header/tests/send-header-selectors.test.js
@@ -0,0 +1,47 @@
+import assert from 'assert'
+import proxyquire from 'proxyquire'
+
+const {
+ getTitleKey,
+ getSubtitleParams,
+} = proxyquire('../send-header.selectors', {
+ '../send.selectors': {
+ getSelectedToken: (mockState) => mockState.t,
+ getSendEditingTransactionId: (mockState) => mockState.e,
+ },
+})
+
+describe('send-header selectors', () => {
+
+ describe('getTitleKey()', () => {
+ it('should return the correct key when getSendEditingTransactionId is truthy', () => {
+ assert.equal(getTitleKey({ e: 1, t: true }), 'edit')
+ })
+
+ it('should return the correct key when getSendEditingTransactionId is falsy and getSelectedToken is truthy', () => {
+ assert.equal(getTitleKey({ e: null, t: 'abc' }), 'sendTokens')
+ })
+
+ it('should return the correct key when getSendEditingTransactionId is falsy and getSelectedToken is falsy', () => {
+ assert.equal(getTitleKey({ e: null }), 'sendETH')
+ })
+ })
+
+ describe('getSubtitleParams()', () => {
+ it('should return the correct params when getSendEditingTransactionId is truthy', () => {
+ assert.deepEqual(getSubtitleParams({ e: 1, t: true }), [ 'editingTransaction' ])
+ })
+
+ it('should return the correct params when getSendEditingTransactionId is falsy and getSelectedToken is truthy', () => {
+ assert.deepEqual(
+ getSubtitleParams({ e: null, t: { symbol: 'ABC' } }),
+ [ 'onlySendTokensToAccountAddress', [ 'ABC' ] ]
+ )
+ })
+
+ it('should return the correct params when getSendEditingTransactionId is falsy and getSelectedToken is falsy', () => {
+ assert.deepEqual(getSubtitleParams({ e: null }), [ 'onlySendToEtherAddress' ])
+ })
+ })
+
+})