chore(tests): lint

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-24 00:13:01 +02:00
parent ade07841b9
commit a238c6d3f5
3 changed files with 21 additions and 7 deletions
@@ -28,14 +28,18 @@ describe('Store Action: `setElements`', () => {
it('has correct element types', () => {
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
}, Object.keys(defaultNodeTypes))
store.nodes.value.forEach((el) => expect(nodeTypes).to.include(el.type))
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
}, Object.keys(defaultEdgeTypes))
@@ -16,11 +16,17 @@ describe('Store Action: `setState`', () => {
const storedState = store[<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)) {
return expect(JSON.stringify(storedState)).to.eq(JSON.stringify(initialVal))