|
| 1 | +import { Map } from 'immutable'; |
1 | 2 | import { |
2 | 3 | COUNTER_INCREMENT, |
3 | 4 | increment, |
@@ -55,14 +56,14 @@ describe('(Redux Module) Counter', function () { |
55 | 56 | let _getStateSpy; |
56 | 57 |
|
57 | 58 | beforeEach(function () { |
58 | | - _globalState = { |
| 59 | + _globalState = new Map(); |
| 60 | + _globalState = _globalState.merge({ |
59 | 61 | counter: counterReducer(undefined, {}) |
60 | | - }; |
| 62 | + }); |
61 | 63 | _dispatchSpy = sinon.spy((action) => { |
62 | | - _globalState = { |
63 | | - ..._globalState, |
64 | | - counter: counterReducer(_globalState.counter, action) |
65 | | - }; |
| 64 | + _globalState = _globalState.merge({ |
| 65 | + counter: counterReducer(_globalState.get('counter'), action) |
| 66 | + }); |
66 | 67 | }); |
67 | 68 | _getStateSpy = sinon.spy(() => { |
68 | 69 | return _globalState; |
@@ -90,19 +91,19 @@ describe('(Redux Module) Counter', function () { |
90 | 91 | }); |
91 | 92 |
|
92 | 93 | it('Should produce a state that is double the previous state.', function () { |
93 | | - _globalState = { counter: 2 }; |
| 94 | + _globalState = _globalState.merge({ counter: 2 }); |
94 | 95 |
|
95 | 96 | return doubleAsync()(_dispatchSpy, _getStateSpy) |
96 | 97 | .then(() => { |
97 | 98 | _dispatchSpy.should.have.been.calledOnce; |
98 | 99 | _getStateSpy.should.have.been.calledOnce; |
99 | | - expect(_globalState.counter).to.equal(4); |
| 100 | + expect(_globalState.get('counter')).to.equal(4); |
100 | 101 | return doubleAsync()(_dispatchSpy, _getStateSpy); |
101 | 102 | }) |
102 | 103 | .then(() => { |
103 | 104 | _dispatchSpy.should.have.been.calledTwice; |
104 | 105 | _getStateSpy.should.have.been.calledTwice; |
105 | | - expect(_globalState.counter).to.equal(8); |
| 106 | + expect(_globalState.get('counter')).to.equal(8); |
106 | 107 | }); |
107 | 108 | }); |
108 | 109 | }); |
|
0 commit comments