3
3
import assert from 'assert' ;
4
4
import { IS_PLAYING } from '../../app/actions/isPlaying' ;
5
5
import { IS_PAUSED } from '../../app/actions/isPaused' ;
6
+ import { HAS_STOPPED } from '../../app/actions/hasStopped' ;
6
7
import { setPlaybackState as playbackReducer } from '../../app/reducers/playback' ;
7
8
8
9
describe ( 'playbackState' , ( ) => {
@@ -11,7 +12,7 @@ describe('playbackState', () => {
11
12
assert . strictEqual ( playbackReducer ( undefined , '' ) . isPlaying , false ) ;
12
13
} ) ;
13
14
14
- it ( '{isPlaying: true, isPaused: false} when isPlaying is true' , ( ) => {
15
+ it ( '{isPlaying: true, isPaused: false} when action. isPlaying is true' , ( ) => {
15
16
const state = playbackReducer ( undefined , {
16
17
type : IS_PLAYING ,
17
18
isPlaying : true
@@ -20,7 +21,7 @@ describe('playbackState', () => {
20
21
assert . strictEqual ( state . isPaused , false ) ;
21
22
} ) ;
22
23
23
- it ( '{isPlaying: false, isPaused: true} when isPlaying is false' , ( ) => {
24
+ it ( '{isPlaying: false, isPaused: true} when action. isPlaying is false' , ( ) => {
24
25
const state = playbackReducer ( undefined , {
25
26
type : IS_PLAYING ,
26
27
isPlaying : false
@@ -35,7 +36,7 @@ describe('playbackState', () => {
35
36
assert . strictEqual ( playbackReducer ( undefined , '' ) . isPaused , false ) ;
36
37
} ) ;
37
38
38
- it ( '{isPlaying: false, isPaused: true} when isPaused is true' , ( ) => {
39
+ it ( '{isPlaying: false, isPaused: true} when action. isPaused is true' , ( ) => {
39
40
const state = playbackReducer ( undefined , {
40
41
type : IS_PAUSED ,
41
42
isPaused : true
@@ -44,7 +45,7 @@ describe('playbackState', () => {
44
45
assert . strictEqual ( state . isPlaying , false ) ;
45
46
} ) ;
46
47
47
- it ( '{isPlaying: true, isPaused: false} when isPaused is false' , ( ) => {
48
+ it ( '{isPlaying: true, isPaused: false} when action. isPaused is false' , ( ) => {
48
49
const state = playbackReducer ( undefined , {
49
50
type : IS_PAUSED ,
50
51
isPaused : false
@@ -53,4 +54,26 @@ describe('playbackState', () => {
53
54
assert . strictEqual ( state . isPlaying , true ) ;
54
55
} ) ;
55
56
} ) ;
57
+
58
+ describe ( 'hasStopped property' , ( ) => {
59
+ it ( 'defaults to true' , ( ) => {
60
+ assert . strictEqual ( playbackReducer ( undefined , '' ) . hasStopped , true ) ;
61
+ } ) ;
62
+
63
+ it ( '{hasStopped: true} when action.hasStopped is true' , ( ) => {
64
+ const state = playbackReducer ( undefined , {
65
+ type : HAS_STOPPED ,
66
+ hasStopped : true
67
+ } ) ;
68
+ assert . strictEqual ( state . hasStopped , true ) ;
69
+ } ) ;
70
+
71
+ it ( '{hasStopped: false} when action.hasStopped is false' , ( ) => {
72
+ const state = playbackReducer ( undefined , {
73
+ type : HAS_STOPPED ,
74
+ hasStopped : false
75
+ } ) ;
76
+ assert . strictEqual ( state . hasStopped , false ) ;
77
+ } ) ;
78
+ } ) ;
56
79
} ) ;
0 commit comments