1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import state from 'state'
- import * as json from './__mocks__/document.json'
-
- describe('project', () => {
- state.reset()
- state.enableLog(true)
-
- it('mounts the state', () => {
- state.send('MOUNTED').send('MOUNTED_SHAPES')
-
- expect(state.isIn('ready')).toBe(true)
- })
-
- it('loads file from json', () => {
- state.send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
-
- expect(state.isIn('ready')).toBe(true)
- expect(state.data.document).toMatchSnapshot('data after mount from file')
- })
- })
-
- describe('restoring project', () => {
- state.reset()
- state.enableLog(true)
-
- it('remounts the state after mutating the current state', () => {
- state
- .send('MOUNTED')
- .send('MOUNTED_SHAPES')
- .send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
- .send('CLEARED_PAGE')
-
- expect(
- state.data.document.pages[state.data.currentPageId].shapes
- ).toStrictEqual({})
-
- state
- .send('MOUNTED')
- .send('MOUNTED_SHAPES')
- .send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
-
- expect(state.data.document).toMatchSnapshot('data after re-mount from file')
- })
- })
|