diff options
author | Alexander Tseung <alextsg@users.noreply.github.com> | 2018-12-14 10:19:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 10:19:36 +0800 |
commit | 30a2be85eebe4f6b8cddb297f14faba392fe1133 (patch) | |
tree | 34cec0a1910e9e16bbed103d4b0f65f61724f8fb /ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js | |
parent | 435fdae84ac49b1366b8737215d97bd82002dccf (diff) | |
download | tangerine-wallet-browser-30a2be85eebe4f6b8cddb297f14faba392fe1133.tar.gz tangerine-wallet-browser-30a2be85eebe4f6b8cddb297f14faba392fe1133.tar.zst tangerine-wallet-browser-30a2be85eebe4f6b8cddb297f14faba392fe1133.zip |
Prevent users from changing the From field in the send screen (#5922)
* Prevent users from changing the From field in the send screen
* Fix integration tests
Diffstat (limited to 'ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js')
-rw-r--r-- | ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js index e080b2fe3..fd771ea77 100644 --- a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js +++ b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js @@ -1,110 +1,26 @@ import assert from 'assert' import proxyquire from 'proxyquire' -import sinon from 'sinon' let mapStateToProps -let mapDispatchToProps - -const actionSpies = { - updateSendFrom: sinon.spy(), - setSendTokenBalance: sinon.spy(), -} -const duckActionSpies = { - closeFromDropdown: sinon.spy(), - openFromDropdown: sinon.spy(), -} proxyquire('../send-from-row.container.js', { 'react-redux': { - connect: (ms, md) => { + connect: ms => { mapStateToProps = ms - mapDispatchToProps = md return () => ({}) }, }, '../../send.selectors.js': { - accountsWithSendEtherInfoSelector: (s) => `mockFromAccounts:${s}`, - getConversionRate: (s) => `mockConversionRate:${s}`, - getSelectedTokenContract: (s) => `mockTokenContract:${s}`, getSendFromObject: (s) => `mockFrom:${s}`, }, - './send-from-row.selectors.js': { getFromDropdownOpen: (s) => `mockFromDropdownOpen:${s}` }, - '../../send.utils.js': { calcTokenBalance: ({ usersToken, selectedToken }) => usersToken + selectedToken }, - '../../../../actions': actionSpies, - '../../../../ducks/send.duck': duckActionSpies, }) describe('send-from-row container', () => { - describe('mapStateToProps()', () => { - it('should map the correct properties to props', () => { assert.deepEqual(mapStateToProps('mockState'), { - conversionRate: 'mockConversionRate:mockState', from: 'mockFrom:mockState', - fromAccounts: 'mockFromAccounts:mockState', - fromDropdownOpen: 'mockFromDropdownOpen:mockState', - tokenContract: 'mockTokenContract:mockState', - }) - }) - - }) - - describe('mapDispatchToProps()', () => { - let dispatchSpy - let mapDispatchToPropsObject - - beforeEach(() => { - dispatchSpy = sinon.spy() - mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy) - }) - - describe('closeFromDropdown()', () => { - it('should dispatch a closeFromDropdown action', () => { - mapDispatchToPropsObject.closeFromDropdown() - assert(dispatchSpy.calledOnce) - assert(duckActionSpies.closeFromDropdown.calledOnce) - assert.equal( - duckActionSpies.closeFromDropdown.getCall(0).args[0], - undefined - ) }) }) - - describe('openFromDropdown()', () => { - it('should dispatch a openFromDropdown action', () => { - mapDispatchToPropsObject.openFromDropdown() - assert(dispatchSpy.calledOnce) - assert(duckActionSpies.openFromDropdown.calledOnce) - assert.equal( - duckActionSpies.openFromDropdown.getCall(0).args[0], - undefined - ) - }) - }) - - describe('updateSendFrom()', () => { - it('should dispatch an updateSendFrom action', () => { - mapDispatchToPropsObject.updateSendFrom('mockFrom') - assert(dispatchSpy.calledOnce) - assert.equal( - actionSpies.updateSendFrom.getCall(0).args[0], - 'mockFrom' - ) - }) - }) - - describe('setSendTokenBalance()', () => { - it('should dispatch an setSendTokenBalance action', () => { - mapDispatchToPropsObject.setSendTokenBalance('mockUsersToken', 'mockSelectedToken') - assert(dispatchSpy.calledOnce) - assert.equal( - actionSpies.setSendTokenBalance.getCall(0).args[0], - 'mockUsersTokenmockSelectedToken' - ) - }) - }) - }) - }) |