mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 14:02:50 -05:00
24 lines
959 B
JavaScript
24 lines
959 B
JavaScript
/* eslint-env jest */
|
|
import Modes from '../../src/modes/modes';
|
|
import reducer from '../../src/reducers/modes';
|
|
import {changeMode} from '../../src/reducers/modes';
|
|
|
|
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 */))
|
|
.toBe(Modes.BRUSH);
|
|
expect(reducer(Modes.BRUSH /* state */, changeMode() /* action */)).toBe(Modes.BRUSH);
|
|
});
|