Update delete.test.ts

This commit is contained in:
Steve Ruiz 2021-06-29 13:13:46 +01:00
parent 2ac8a15761
commit e4b154950f

View file

@ -1,7 +1,6 @@
import state from 'state' import state from 'state'
import inputs from 'state/inputs' import inputs from 'state/inputs'
import { ShapeType } from 'types' import { ShapeType } from 'types'
import { getShape } from 'utils'
import { import {
idsAreSelected, idsAreSelected,
point, point,
@ -10,6 +9,7 @@ import {
getOnlySelectedShape, getOnlySelectedShape,
assertShapeProps, assertShapeProps,
} from './test-utils' } from './test-utils'
import tld from 'utils/tld'
import * as json from './__mocks__/document.json' import * as json from './__mocks__/document.json'
describe('deleting single shapes', () => { describe('deleting single shapes', () => {
@ -27,16 +27,16 @@ describe('deleting single shapes', () => {
state.send('DELETED') state.send('DELETED')
expect(idsAreSelected(state.data, [])).toBe(true) expect(idsAreSelected(state.data, [])).toBe(true)
expect(getShape(state.data, rectangleId)).toBe(undefined) expect(tld.getShape(state.data, rectangleId)).toBe(undefined)
state.send('UNDO') state.send('UNDO')
expect(getShape(state.data, rectangleId)).toBeTruthy() expect(tld.getShape(state.data, rectangleId)).toBeTruthy()
expect(idsAreSelected(state.data, [rectangleId])).toBe(true) expect(idsAreSelected(state.data, [rectangleId])).toBe(true)
state.send('REDO') state.send('REDO')
expect(getShape(state.data, rectangleId)).toBe(undefined) expect(tld.getShape(state.data, rectangleId)).toBe(undefined)
state.send('UNDO') state.send('UNDO')
}) })
@ -142,16 +142,16 @@ describe('deletes and restores grouped shapes', () => {
// // // Delete the rectangle first // // // Delete the rectangle first
// // state.send('UNDO') // // state.send('UNDO')
// // expect(getShape(state.data, rectangleId)).toBeTruthy() // // expect(tld.getShape(state.data, rectangleId)).toBeTruthy()
// // expect(idsAreSelected(state.data, [rectangleId])).toBe(true) // // expect(idsAreSelected(state.data, [rectangleId])).toBe(true)
// // state.send('REDO') // // state.send('REDO')
// // expect(getShape(state.data, rectangleId)).toBe(undefined) // // expect(tld.getShape(state.data, rectangleId)).toBe(undefined)
// // state.send('UNDO') // // state.send('UNDO')
// // expect(getShape(state.data, rectangleId)).toBeTruthy() // // expect(tld.getShape(state.data, rectangleId)).toBeTruthy()
// // expect(idsAreSelected(state.data, [rectangleId])).toBe(true) // // expect(idsAreSelected(state.data, [rectangleId])).toBe(true)
// // }) // // })
// }) // })