Commit 96878844 authored by Michael Vrána's avatar Michael Vrána

Test fixes

parent 9f812f04
Pipeline #80099 passed with stages
in 4 minutes and 3 seconds
......@@ -4,7 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Debug worker",
"type": "cppdbg",
......@@ -25,24 +24,13 @@
}
]
},
{
"type": "node",
"request": "launch",
"protocol": "inspector",
"name": "Debug Broker",
"sourceMaps": true,
"cwd": "${workspaceFolder}/broker",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"args": ["index.ts"],
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Debug CRA Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"runtimeExecutable": "${workspaceRoot}/webui/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache", "--watchAll"],
"cwd": "${workspaceRoot}",
"cwd": "${workspaceRoot}/webui",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
......
......@@ -74,42 +74,10 @@ describe('canvas reducer', () => {
expect(reducer(initialState, actions.deselect())).toEqual({
...initialState,
selectedNode: '',
selectedEdge: '',
// ghostTransition: {
// ...initialState.ghostTransition,
// startState: '',
// endState: ''
// }
selectedEdge: ''
} as CanvasState)
})
// it('correctly updates ghost state', () => {
// expect(
// reducer(initialState, actions.updateGhostState({ size: 25 }))
// ).toEqual({
// ...initialState,
// ghostState: {
// ...initialState.ghostState,
// size: 25
// }
// } as CanvasState)
// })
// it('correctly updates ghost transition', () => {
// expect(
// reducer(
// initialState,
// actions.updateGhostTransition({ startState: 'x' })
// )
// ).toEqual({
// ...initialState,
// ghostTransition: {
// ...initialState.ghostTransition,
// startState: 'x'
// }
// } as CanvasState)
// })
it('correctly selects state', () => {
expect(reducer(initialState, actions.selectNode('x'))).toEqual({
...initialState,
......@@ -117,21 +85,6 @@ describe('canvas reducer', () => {
} as CanvasState)
})
it('correctly deselects state', () => {
expect(
reducer(
{
...initialState,
selectedNode: 'x'
},
actions.selectNode('x')
)
).toEqual({
...initialState,
selectedNode: ''
} as CanvasState)
})
it('correctly selects transition', () => {
expect(reducer(initialState, actions.selectEdge('x'))).toEqual({
...initialState,
......@@ -153,18 +106,4 @@ describe('canvas reducer', () => {
selectedEdge: ''
} as CanvasState)
})
// it('correctly increases state id', () => {
// expect(reducer(initialState, actions.incrementStateNameId())).toEqual({
// ...initialState,
// stateNameId: 2
// } as CanvasState)
// })
// it('correctly increases transition id', () => {
// expect(reducer(initialState, actions.incrementTransitionNameId())).toEqual({
// ...initialState,
// transitionNameId: 2
// } as CanvasState)
// })
})
......@@ -146,11 +146,4 @@ describe('toolbar reducer', () => {
mouseMode: 'horizontal'
} as State)
})
it('toggles grid', () => {
expect(reducer(initialState, Actions.toggleGrid())).toEqual({
...initialState,
grid: !initialState.grid
} as State)
})
})
jest.mock('uuid', () => {
let id = 0
return { v4: () => (++id).toString(), reset: () => (id = 0) }
})
import uuid from 'uuid'
import StateData from '../../../interfaces/StateData'
import Map from '../../../interfaces/Map'
import State from '../../../interfaces/State'
......@@ -100,14 +107,11 @@ export const file: string = `{
}`
describe('import json', () => {
afterEach(() => {
jest.resetModules()
})
beforeEach(() => {
jest.mock('uuid')
})
beforeEach(() => (uuid as any).reset())
it('converts', () => {
expect(importData(file)).toEqual(data)
})
afterAll(() => jest.resetModules())
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment