Fix tests

This commit is contained in:
Steve Ruiz 2021-07-14 09:08:12 +01:00
parent 03326adbaf
commit 0855a92497
6 changed files with 20 additions and 5 deletions

View file

@ -6,7 +6,10 @@ import tld from 'utils/tld'
jest.useRealTimers() jest.useRealTimers()
state.reset() state.reset()
state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) state
.send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
state.send('CLEARED_PAGE') state.send('CLEARED_PAGE')
describe('selection', () => { describe('selection', () => {

View file

@ -3,7 +3,10 @@ import coopState from 'state/coop/coop-state'
import * as json from './__mocks__/document.json' import * as json from './__mocks__/document.json'
state.reset() state.reset()
state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) state
.send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
state.send('CLEARED_PAGE') state.send('CLEARED_PAGE')
coopState.reset() coopState.reset()

View file

@ -2,7 +2,10 @@ import state from 'state'
import * as json from './__mocks__/document.json' import * as json from './__mocks__/document.json'
state.reset() state.reset()
state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) state
.send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
state.send('CLEARED_PAGE') state.send('CLEARED_PAGE')
describe('arrow shape', () => { describe('arrow shape', () => {

View file

@ -6,7 +6,7 @@ describe('project', () => {
state.enableLog(true) state.enableLog(true)
it('mounts the state', () => { it('mounts the state', () => {
state.send('MOUNTED') state.send('MOUNTED').send('MOUNTED_SHAPES')
expect(state.isIn('ready')).toBe(true) expect(state.isIn('ready')).toBe(true)
}) })
@ -26,6 +26,7 @@ describe('restoring project', () => {
it('remounts the state after mutating the current state', () => { it('remounts the state after mutating the current state', () => {
state state
.send('MOUNTED') .send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) .send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
.send('CLEARED_PAGE') .send('CLEARED_PAGE')
@ -35,6 +36,7 @@ describe('restoring project', () => {
state state
.send('MOUNTED') .send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) .send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
expect(state.data.document).toMatchSnapshot('data after re-mount from file') expect(state.data.document).toMatchSnapshot('data after re-mount from file')

View file

@ -2,7 +2,10 @@ import state from 'state'
import * as json from './__mocks__/document.json' import * as json from './__mocks__/document.json'
state.reset() state.reset()
state.send('MOUNTED').send('LOADED_FROM_FILE', { json: JSON.stringify(json) }) state
.send('MOUNTED')
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(json) })
state.send('CLEARED_PAGE') state.send('CLEARED_PAGE')
describe('shape styles', () => { describe('shape styles', () => {

View file

@ -45,6 +45,7 @@ class TestState {
this.state this.state
.send('UNMOUNTED') .send('UNMOUNTED')
.send('MOUNTED', { roomId: 'TESTING' }) .send('MOUNTED', { roomId: 'TESTING' })
.send('MOUNTED_SHAPES')
.send('LOADED_FROM_FILE', { json: JSON.stringify(mockDocument) }) .send('LOADED_FROM_FILE', { json: JSON.stringify(mockDocument) })
return this return this