Skip to content

Commit 2d0870f

Browse files
committed
Removing isPaused as it is not needed
1 parent 251627c commit 2d0870f

File tree

4 files changed

+3
-81
lines changed

4 files changed

+3
-81
lines changed

app/actions/isPaused.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/reducers/playback.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
'use strict';
22

33
import { IS_PLAYING } from '../actions/isPlaying';
4-
import { IS_PAUSED } from '../actions/isPaused';
54
import { HAS_STOPPED } from '../actions/hasStopped';
65

76
const initialState = {
87
isPlaying: false,
9-
isPaused: false,
108
hasStopped: true
119
};
1210

@@ -18,20 +16,6 @@ function setIsPlayingState(isPlaying) {
1816
if (isPlaying === false) return newState;
1917

2018
return Object.assign({}, newState, {
21-
isPaused: false,
22-
hasStopped: false
23-
});
24-
}
25-
26-
function setIsPausedState(isPaused) {
27-
const newState = {
28-
isPaused: isPaused
29-
};
30-
31-
if (isPaused === false) return newState;
32-
33-
return Object.assign({}, newState, {
34-
isPlaying: false,
3519
hasStopped: false
3620
});
3721
}
@@ -44,17 +28,14 @@ function setHasStoppedState(hasStopped) {
4428
if (hasStopped === false) return newState;
4529

4630
return Object.assign({}, newState, {
47-
isPlaying: false,
48-
isPaused: false
31+
isPlaying: false
4932
});
5033
}
5134

5235
export function playbackReducer(state = initialState, action) {
5336
switch (action.type) {
5437
case IS_PLAYING :
5538
return Object.assign({}, state, setIsPlayingState(action.isPlaying));
56-
case IS_PAUSED :
57-
return Object.assign({}, state, setIsPausedState(action.isPaused));
5839
case HAS_STOPPED :
5940
return Object.assign({}, state, setHasStoppedState(action.hasStopped));
6041
default:

test/actions/isPaused.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/reducers/playback.js

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import assert from 'assert';
44
import { IS_PLAYING } from '../../app/actions/isPlaying';
5-
import { IS_PAUSED } from '../../app/actions/isPaused';
65
import { HAS_STOPPED } from '../../app/actions/hasStopped';
76
import { playbackReducer } from '../../app/reducers/playback';
87

@@ -12,14 +11,13 @@ describe('playbackState', () => {
1211
assert.strictEqual(playbackReducer(undefined, '').isPlaying, false);
1312
});
1413

15-
it('{isPlaying: true, isPaused: false, hasStopped: false} when action.isPlaying is true', () => {
14+
it('{isPlaying: true, hasStopped: false} when action.isPlaying is true', () => {
1615
const state = playbackReducer(undefined, {
1716
type: IS_PLAYING,
1817
isPlaying: true
1918
});
2019

2120
assert.strictEqual(state.isPlaying, true);
22-
assert.strictEqual(state.isPaused, false);
2321
assert.strictEqual(state.hasStopped, false);
2422
});
2523

@@ -33,45 +31,18 @@ describe('playbackState', () => {
3331
});
3432
});
3533

36-
describe('isPaused property', () => {
37-
it('defaults to false', () => {
38-
assert.strictEqual(playbackReducer(undefined, '').isPaused, false);
39-
});
40-
41-
it('{isPlaying: false, isPaused: true, hasStopped: false} when action.isPaused is true', () => {
42-
const state = playbackReducer(undefined, {
43-
type: IS_PAUSED,
44-
isPaused: true
45-
});
46-
47-
assert.strictEqual(state.isPlaying, false);
48-
assert.strictEqual(state.isPaused, true);
49-
assert.strictEqual(state.hasStopped, false);
50-
});
51-
52-
it('{isPaused: false} when action.isPaused is false', () => {
53-
const state = playbackReducer(undefined, {
54-
type: IS_PAUSED,
55-
isPaused: false
56-
});
57-
58-
assert.strictEqual(state.isPaused, false);
59-
});
60-
});
61-
6234
describe('hasStopped property', () => {
6335
it('defaults to true', () => {
6436
assert.strictEqual(playbackReducer(undefined, '').hasStopped, true);
6537
});
6638

67-
it('{isPlaying: false, isPaused: false, hasStopped: true} when action.hasStopped is true', () => {
39+
it('{isPlaying: false, hasStopped: true} when action.hasStopped is true', () => {
6840
const state = playbackReducer(undefined, {
6941
type: HAS_STOPPED,
7042
hasStopped: true
7143
});
7244

7345
assert.strictEqual(state.isPlaying, false);
74-
assert.strictEqual(state.isPaused, false);
7546
assert.strictEqual(state.hasStopped, true);
7647
});
7748

0 commit comments

Comments
 (0)