aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js
blob: 5b133fbe24f22705590be2b37586e4dc423ad8f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import assert from 'assert'
import proxyquire from 'proxyquire'
import sinon from 'sinon'

// let mapStateToProps
let mapDispatchToProps

const actionSpies = {
  hideModal: sinon.spy(),
}

proxyquire('../gas-modal-page-container.container.js', {
  'react-redux': {
    connect: (ms, md) => {
      // mapStateToProps = ms
      mapDispatchToProps = md
      return () => ({})
    },
  },
  '../../../actions': actionSpies,
})

describe('gas-modal-page-container container', () => {

  describe('mapDispatchToProps()', () => {
    let dispatchSpy
    let mapDispatchToPropsObject

    beforeEach(() => {
      dispatchSpy = sinon.spy()
      mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy)
    })

    describe('hideModal()', () => {
      it('should dispatch a hideModal action', () => {
        mapDispatchToPropsObject.hideModal()
        assert(dispatchSpy.calledOnce)
        assert(actionSpies.hideModal.calledOnce)
      })
    })

  })

})