mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-06-15 06:31:35 -04:00
Add format reducer
This commit is contained in:
parent
e6b151c41f
commit
2b8c291765
4 changed files with 66 additions and 0 deletions
test/unit
24
test/unit/format-reducer.test.js
Normal file
24
test/unit/format-reducer.test.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* eslint-env jest */
|
||||
import Formats from '../../src/lib/format';
|
||||
import reducer from '../../src/reducers/format';
|
||||
import {changeFormat} from '../../src/reducers/format';
|
||||
|
||||
test('initialState', () => {
|
||||
let defaultState;
|
||||
expect(reducer(defaultState /* state */, {type: 'anything'} /* action */) in Formats).toBeTruthy();
|
||||
});
|
||||
|
||||
test('changeFormat', () => {
|
||||
let defaultState;
|
||||
expect(reducer(defaultState /* state */, changeFormat(Formats.BITMAP) /* action */)).toBe(Formats.BITMAP);
|
||||
expect(reducer(Formats.BITMAP /* state */, changeFormat(Formats.BITMAP) /* action */))
|
||||
.toBe(Formats.BITMAP);
|
||||
expect(reducer(Formats.BITMAP /* state */, changeFormat(Formats.VECTOR) /* action */))
|
||||
.toBe(Formats.VECTOR);
|
||||
});
|
||||
|
||||
test('invalidChangeMode', () => {
|
||||
expect(reducer(Formats.BITMAP /* state */, changeFormat('non-existant mode') /* action */))
|
||||
.toBe(Formats.BITMAP);
|
||||
expect(reducer(Formats.BITMAP /* state */, changeFormat() /* action */)).toBe(Formats.BITMAP);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue