diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2019-04-25 03:25:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-25 03:25:39 +0800 |
commit | 87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a (patch) | |
tree | 2230335f440e36c23f47e0794e94cf6b0b312024 /ui/app/pages/send/send-header/tests/send-header-selectors.test.js | |
parent | 8c98e89e617b594d4f0ee54a8437e30201688090 (diff) | |
parent | 6a60562d6649d88f24bd849b325871bb256a0001 (diff) | |
download | tangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.tar.gz tangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.tar.zst tangerine-wallet-browser-87d5be9081fd3ab3bfb4ae67d5cab4b8a8304a8a.zip |
Merge pull request #6484 from MetaMask/develop
Update master branch with develop (v6.4.0)
Diffstat (limited to 'ui/app/pages/send/send-header/tests/send-header-selectors.test.js')
-rw-r--r-- | ui/app/pages/send/send-header/tests/send-header-selectors.test.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ui/app/pages/send/send-header/tests/send-header-selectors.test.js b/ui/app/pages/send/send-header/tests/send-header-selectors.test.js new file mode 100644 index 000000000..e0c6a3ab3 --- /dev/null +++ b/ui/app/pages/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' ]) + }) + }) + +}) |