@@ -6,6 +6,9 @@ import _ from 'lodash';
6
6
7
7
import configureStore from '../../app/store/configurePlayerStore' ;
8
8
import mapStoreToPlayer from '../../app/store/mapStoreToPlayer' ;
9
+ import { HAS_STOPPED } from '../../app/actions/hasStopped' ;
10
+ import { SET_PROGRESS } from '../../app/actions/setProgress' ;
11
+ import { SET_DURATION } from '../../app/actions/setDuration' ;
9
12
10
13
const store = configureStore ( ) ;
11
14
const sandbox = sinon . sandbox . create ( ) ;
@@ -127,7 +130,7 @@ describe('mapStoreToPlayer', () => {
127
130
const player = setupPlayer ( ) ;
128
131
const unsubscribe = mapStoreToPlayer ( store , player ) ;
129
132
const expectedCallArgs = {
130
- type : ' HAS_STOPPED' ,
133
+ type : HAS_STOPPED ,
131
134
hasStopped : true
132
135
} ;
133
136
@@ -143,7 +146,7 @@ describe('mapStoreToPlayer', () => {
143
146
} ) ;
144
147
const unsubscribe = mapStoreToPlayer ( store , player ) ;
145
148
const expectedCallArgs = {
146
- type : ' SET_PROGRESS' ,
149
+ type : SET_PROGRESS ,
147
150
progress : 75
148
151
} ;
149
152
@@ -152,5 +155,20 @@ describe('mapStoreToPlayer', () => {
152
155
153
156
unsubscribe ( ) ;
154
157
} ) ;
158
+
159
+ it ( 'dispatched SET_DURATION: {NUMBER} when the player is loaded' , ( ) => {
160
+ const player = setupPlayer ( {
161
+ duration : 75
162
+ } ) ;
163
+ const unsubscribe = mapStoreToPlayer ( store , player ) ;
164
+ const expectedCallArgs = {
165
+ type : SET_DURATION ,
166
+ duration : 75
167
+ } ;
168
+
169
+ assert ( store . dispatch . calledWith ( expectedCallArgs ) ) ;
170
+
171
+ unsubscribe ( ) ;
172
+ } ) ;
155
173
} ) ;
156
174
} ) ;
0 commit comments