File size: 1,421 Bytes
6bcb42f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* eslint-env jest */
import modeReducer from '../../../src/reducers/mode';

const SET_FULL_SCREEN = 'scratch-gui/mode/SET_FULL_SCREEN';
const SET_PLAYER = 'scratch-gui/mode/SET_PLAYER';

test('initialState', () => {
    let defaultState;
    /* modeReducer(state, action) */
    expect(modeReducer(defaultState, {type: 'anything'})).toBeDefined();
});

test('set full screen mode', () => {
    const previousState = {
        showBranding: false,
        isFullScreen: false,
        isPlayerOnly: false,
        hasEverEnteredEditor: true
    };
    const action = {
        type: SET_FULL_SCREEN,
        isFullScreen: true
    };
    const newState = {
        showBranding: false,
        isFullScreen: true,
        isPlayerOnly: false,
        hasEverEnteredEditor: true
    };
    /* modeReducer(state, action) */
    expect(modeReducer(previousState, action)).toEqual(newState);
});

test('set player mode', () => {
    const previousState = {
        showBranding: false,
        isFullScreen: false,
        isPlayerOnly: false,
        hasEverEnteredEditor: true
    };
    const action = {
        type: SET_PLAYER,
        isPlayerOnly: true
    };
    const newState = {
        showBranding: false,
        isFullScreen: false,
        isPlayerOnly: true,
        hasEverEnteredEditor: true
    };
    /* modeReducer(state, action) */
    expect(modeReducer(previousState, action)).toEqual(newState);
});