| | |
| | import Formats from '../../src/lib/format'; |
| | import reducer, {changeFormat} from '../../src/reducers/format'; |
| | import {undo, redo} from '../../src/reducers/undo'; |
| |
|
| | test('initialState', () => { |
| | let defaultState; |
| | expect(reducer(defaultState , {type: 'anything'} )).toBeNull(); |
| | }); |
| |
|
| | test('changeFormat', () => { |
| | let defaultState; |
| | expect(reducer(defaultState , changeFormat(Formats.BITMAP) )).toBe(Formats.BITMAP); |
| | expect(reducer(Formats.BITMAP , changeFormat(Formats.BITMAP) )) |
| | .toBe(Formats.BITMAP); |
| | expect(reducer(Formats.BITMAP , changeFormat(Formats.VECTOR) )) |
| | .toBe(Formats.VECTOR); |
| | }); |
| |
|
| | test('undoRedoChangeFormat', () => { |
| | let defaultState; |
| | let reduxState = reducer(defaultState , changeFormat(Formats.BITMAP) ); |
| | expect(reduxState).toBe(Formats.BITMAP); |
| | reduxState = reducer(reduxState , undo(Formats.BITMAP_SKIP_CONVERT) ); |
| | expect(reduxState).toBe(Formats.BITMAP_SKIP_CONVERT); |
| | reduxState = reducer(reduxState , redo(Formats.VECTOR_SKIP_CONVERT) ); |
| | expect(reduxState).toBe(Formats.VECTOR_SKIP_CONVERT); |
| | }); |
| |
|
| | test('invalidChangeMode', () => { |
| | expect(reducer(Formats.BITMAP , changeFormat('non-existant mode') )) |
| | .toBe(Formats.BITMAP); |
| | expect(reducer(Formats.BITMAP , changeFormat() )).toBe(Formats.BITMAP); |
| | }); |
| |
|