From 7dfc5f97e080d220d7f19a328afe644db7dc9430 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 8 Nov 2022 12:47:23 +0100 Subject: [PATCH] test: use default element types in check --- .../component/1-store/elements/setElements.cy.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/cypress/component/1-store/elements/setElements.cy.ts b/e2e/cypress/component/1-store/elements/setElements.cy.ts index 56456c5e..c18bfb72 100644 --- a/e2e/cypress/component/1-store/elements/setElements.cy.ts +++ b/e2e/cypress/component/1-store/elements/setElements.cy.ts @@ -1,4 +1,4 @@ -import { isEdge, isNode, useVueFlow } from '@vue-flow/core' +import { defaultEdgeTypes, defaultNodeTypes, isEdge, isNode, useVueFlow } from '@vue-flow/core' import { getElements } from '../../../utils' const { nodes, edges } = getElements() @@ -27,9 +27,18 @@ describe('Store Action: `setElements`', () => { }) it('has correct element types', () => { - const nodeTypes = nodes.map((node) => node.type) + const nodeTypes = nodes.reduce((types, node) => { + 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.map((edge) => edge.type) + + const edgeTypes = edges.reduce((types, edge) => { + if (edge.type && !types.includes(edge.type)) types.push(edge.type) + return types + }, Object.keys(defaultEdgeTypes)) + store.edges.value.forEach((el) => expect(edgeTypes).to.include(el.type)) })