update(test): remove pinia from tests
* update tests to succeed with new "store" Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { getElements } from '../../../examples/Stress/utils'
|
||||
import { useStore } from '~/composables'
|
||||
import { FlowStore } from '~/types'
|
||||
import { Elements, FlowStore } from '~/types'
|
||||
import { isGraphEdge, isGraphNode } from '~/utils'
|
||||
|
||||
describe('test store action setElements', () => {
|
||||
const setElements = async (store: FlowStore) => {
|
||||
const elements = [
|
||||
const elements: Elements = [
|
||||
{ id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 } },
|
||||
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 100 } },
|
||||
{ id: 'e1-2', source: '1', target: '2', animated: true },
|
||||
@@ -17,7 +17,6 @@ describe('test store action setElements', () => {
|
||||
const store = useStore()
|
||||
await setElements(store)
|
||||
expect(store.elements).to.have.length(3)
|
||||
store.$dispose()
|
||||
})
|
||||
|
||||
context('elements pre-set', () => {
|
||||
@@ -26,7 +25,6 @@ describe('test store action setElements', () => {
|
||||
store = useStore()
|
||||
await setElements(store)
|
||||
})
|
||||
afterEach(() => store.$dispose())
|
||||
|
||||
it('adds elements', () => {
|
||||
store.addElements([{ id: '4', data: { label: 'Node 4' }, position: { x: 500, y: 500 } }])
|
||||
|
||||
@@ -5,15 +5,14 @@ describe('test store state', () => {
|
||||
let store: FlowStore
|
||||
|
||||
beforeEach(() => (store = useStore()))
|
||||
afterEach(() => store.$dispose())
|
||||
|
||||
it('has any initial state', () => {
|
||||
expect(store.$state).to.exist
|
||||
expect(store.state).to.exist
|
||||
})
|
||||
|
||||
it('has default initial state', () => {
|
||||
const initial = initialState()
|
||||
Object.keys(store.$state).forEach((state) => {
|
||||
Object.keys(store.state).forEach((state) => {
|
||||
const storedState = store[<keyof FlowState>state]
|
||||
const initialVal = initial[<keyof FlowState>state]
|
||||
expect(JSON.stringify(storedState)).to.eq(JSON.stringify(initialVal))
|
||||
@@ -32,7 +31,6 @@ describe('test store state', () => {
|
||||
zoomOnScroll: false,
|
||||
})
|
||||
expect(store.zoomOnScroll).to.eq(false)
|
||||
store.$dispose()
|
||||
})
|
||||
|
||||
it('gets custom node types', () => {
|
||||
|
||||
Reference in New Issue
Block a user