Example #1
0
 it('Should call dispatch and getState exactly once.', () => {
   return doubleAsync()(_dispatchSpy, _getStateSpy)
     .then(() => {
       _dispatchSpy.should.have.been.calledOnce
       _getStateSpy.should.have.been.calledOnce
     })
 })
Example #2
0
    it('Should produce a state that is double the previous state.', () => {
      _globalState = { counter: 2 }

      return doubleAsync()(_dispatchSpy, _getStateSpy)
        .then(() => {
          _dispatchSpy.should.have.been.calledOnce
          _getStateSpy.should.have.been.calledOnce
          expect(_globalState.counter).to.equal(4)
          return doubleAsync()(_dispatchSpy, _getStateSpy)
        })
        .then(() => {
          _dispatchSpy.should.have.been.calledTwice
          _getStateSpy.should.have.been.calledTwice
          expect(_globalState.counter).to.equal(8)
        })
    })
Example #3
0
 .then(() => {
   _dispatchSpy.should.have.been.calledOnce
   _getStateSpy.should.have.been.calledOnce
   expect(_globalState.counter).to.equal(4)
   return doubleAsync()(_dispatchSpy, _getStateSpy)
 })
Example #4
0
 it('Should return a promise from that thunk that gets fulfilled.', () => {
   return doubleAsync()(_dispatchSpy, _getStateSpy).should.eventually.be.fulfilled
 })
Example #5
0
 it('Should return a function (is a thunk).', () => {
   expect(doubleAsync()).to.be.a('function')
 })