aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-header
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-05 23:11:53 +0800
committerDan <danjm.com@gmail.com>2018-05-05 23:58:14 +0800
commit7c490098548522c16be1b1e84bce37f5bf87f1f4 (patch)
tree207cabcc9c8a07c411ae293894895f32905986be /ui/app/components/send_/send-header
parente869d09c79b0ba276cb6a82da1f01b2d4bfefce7 (diff)
downloadtangerine-wallet-browser-7c490098548522c16be1b1e84bce37f5bf87f1f4.tar.gz
tangerine-wallet-browser-7c490098548522c16be1b1e84bce37f5bf87f1f4.tar.zst
tangerine-wallet-browser-7c490098548522c16be1b1e84bce37f5bf87f1f4.zip
Unit tests for containers, utils and selectors in send_/
Diffstat (limited to 'ui/app/components/send_/send-header')
-rw-r--r--ui/app/components/send_/send-header/tests/send-header-container.test.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-header/tests/send-header-container.test.js b/ui/app/components/send_/send-header/tests/send-header-container.test.js
index e69de29bb..abce9af6b 100644
--- a/ui/app/components/send_/send-header/tests/send-header-container.test.js
+++ b/ui/app/components/send_/send-header/tests/send-header-container.test.js
@@ -0,0 +1,55 @@
+import assert from 'assert'
+import proxyquire from 'proxyquire'
+import sinon from 'sinon'
+
+let mapStateToProps
+let mapDispatchToProps
+
+const actionSpies = {
+ clearSend: sinon.spy(),
+}
+
+proxyquire('../send-header.container.js', {
+ 'react-redux': {
+ connect: (ms, md) => {
+ mapStateToProps = ms
+ mapDispatchToProps = md
+ return () => ({})
+ },
+ },
+ '../../../actions': actionSpies,
+ '../../../selectors': { getSelectedToken: (s) => `mockSelectedToken:${s}` },
+})
+
+describe('send-header container', () => {
+
+ describe('mapStateToProps()', () => {
+
+ it('should map the correct properties to props', () => {
+ assert.deepEqual(mapStateToProps('mockState'), {
+ isToken: true,
+ })
+ })
+
+ })
+
+ describe('mapDispatchToProps()', () => {
+ let dispatchSpy
+ let mapDispatchToPropsObject
+
+ beforeEach(() => {
+ dispatchSpy = sinon.spy()
+ mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy)
+ })
+
+ describe('clearSend()', () => {
+ it('should dispatch an action', () => {
+ mapDispatchToPropsObject.clearSend()
+ assert(dispatchSpy.calledOnce)
+ assert(actionSpies.clearSend.calledOnce)
+ })
+ })
+
+ })
+
+})