2017-08-16 15:34:33 -04:00
|
|
|
/* eslint-env jest */
|
2017-11-08 10:13:17 -05:00
|
|
|
import Modes from '../../src/lib/modes';
|
2021-02-09 12:14:00 -05:00
|
|
|
import reducer, {changeMode} from '../../src/reducers/modes';
|
2017-08-16 15:34:33 -04:00
|
|
|
|
|
|
|
test('initialState', () => {
|
|
|
|
let defaultState;
|
|
|
|
expect(reducer(defaultState /* state */, {type: 'anything'} /* action */) in Modes).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('changeMode', () => {
|
|
|
|
let defaultState;
|
|
|
|
expect(reducer(defaultState /* state */, changeMode(Modes.ERASER) /* action */)).toBe(Modes.ERASER);
|
|
|
|
expect(reducer(Modes.ERASER /* state */, changeMode(Modes.ERASER) /* action */))
|
|
|
|
.toBe(Modes.ERASER);
|
|
|
|
expect(reducer(Modes.BRUSH /* state */, changeMode(Modes.ERASER) /* action */))
|
|
|
|
.toBe(Modes.ERASER);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('invalidChangeMode', () => {
|
|
|
|
expect(reducer(Modes.BRUSH /* state */, changeMode('non-existant mode') /* action */))
|
2017-08-29 17:24:40 -04:00
|
|
|
.toBe(Modes.BRUSH);
|
2017-08-16 15:34:33 -04:00
|
|
|
expect(reducer(Modes.BRUSH /* state */, changeMode() /* action */)).toBe(Modes.BRUSH);
|
|
|
|
});
|