chore(tests): lint
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -28,14 +28,18 @@ describe('Store Action: `setElements`', () => {
|
|||||||
|
|
||||||
it('has correct element types', () => {
|
it('has correct element types', () => {
|
||||||
const nodeTypes = nodes.reduce((types, node) => {
|
const nodeTypes = nodes.reduce((types, node) => {
|
||||||
if (node.type && !types.includes(node.type)) types.push(node.type)
|
if (node.type && !types.includes(node.type)) {
|
||||||
|
types.push(node.type)
|
||||||
|
}
|
||||||
return types
|
return types
|
||||||
}, Object.keys(defaultNodeTypes))
|
}, Object.keys(defaultNodeTypes))
|
||||||
|
|
||||||
store.nodes.value.forEach((el) => expect(nodeTypes).to.include(el.type))
|
store.nodes.value.forEach((el) => expect(nodeTypes).to.include(el.type))
|
||||||
|
|
||||||
const edgeTypes = edges.reduce((types, edge) => {
|
const edgeTypes = edges.reduce((types, edge) => {
|
||||||
if (edge.type && !types.includes(edge.type)) types.push(edge.type)
|
if (edge.type && !types.includes(edge.type)) {
|
||||||
|
types.push(edge.type)
|
||||||
|
}
|
||||||
return types
|
return types
|
||||||
}, Object.keys(defaultEdgeTypes))
|
}, Object.keys(defaultEdgeTypes))
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,17 @@ describe('Store Action: `setState`', () => {
|
|||||||
const storedState = store[<keyof State>state]?.value
|
const storedState = store[<keyof State>state]?.value
|
||||||
const initialVal = initial[<keyof State>state]?.value
|
const initialVal = initial[<keyof State>state]?.value
|
||||||
|
|
||||||
if (state === 'initialized') return expect(storedState).to.be.true
|
if (state === 'initialized') {
|
||||||
|
return expect(storedState).to.be.true
|
||||||
|
}
|
||||||
|
|
||||||
if (state === 'getEdgeTypes' || state === 'getNodeTypes' || state === 'nodeTypes' || state === 'edgeTypes') return
|
if (state === 'getEdgeTypes' || state === 'getNodeTypes' || state === 'nodeTypes' || state === 'edgeTypes') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(initialVal)) return expect((storedState as any[]).length).to.eq(initialVal.length)
|
if (Array.isArray(initialVal)) {
|
||||||
|
return expect((storedState as any[]).length).to.eq(initialVal.length)
|
||||||
|
}
|
||||||
|
|
||||||
if (!(initialVal instanceof Function) && !isRef(initialVal)) {
|
if (!(initialVal instanceof Function) && !isRef(initialVal)) {
|
||||||
return expect(JSON.stringify(storedState)).to.eq(JSON.stringify(initialVal))
|
return expect(JSON.stringify(storedState)).to.eq(JSON.stringify(initialVal))
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ export function getElements(xElements = 10, yElements = 10) {
|
|||||||
label: `Node ${nodeId}`,
|
label: `Node ${nodeId}`,
|
||||||
style: (node) => {
|
style: (node) => {
|
||||||
const style: Record<string, any> = { width: `50px`, fontSize: `11px`, zIndex: 1 }
|
const style: Record<string, any> = { width: `50px`, fontSize: `11px`, zIndex: 1 }
|
||||||
if (node.selected) style.border = '1px solid red'
|
if (node.selected) {
|
||||||
|
style.border = '1px solid red'
|
||||||
|
}
|
||||||
return style
|
return style
|
||||||
},
|
},
|
||||||
type: 'default',
|
type: 'default',
|
||||||
@@ -32,7 +34,9 @@ export function getElements(xElements = 10, yElements = 10) {
|
|||||||
randomData: Math.floor(Math.random() * 1e3),
|
randomData: Math.floor(Math.random() * 1e3),
|
||||||
},
|
},
|
||||||
style: (edge) => {
|
style: (edge) => {
|
||||||
if (edge.selected) return { stroke: '#10b981', strokeWidth: 3 }
|
if (edge.selected) {
|
||||||
|
return { stroke: '#10b981', strokeWidth: 3 }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
animated: Math.random() > 0.5,
|
animated: Math.random() > 0.5,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user