fix(tests): correct tests
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,8 @@ describe('test store action setElements', () => {
|
||||
it('sets elements', async () => {
|
||||
const store = useStore()
|
||||
await setElements(store)
|
||||
expect(store.elements).to.have.length(3)
|
||||
expect(store.nodes).to.have.length(2)
|
||||
expect(store.edges).to.have.length(1)
|
||||
})
|
||||
|
||||
context('elements pre-set', () => {
|
||||
@@ -45,11 +46,12 @@ describe('test store action setElements', () => {
|
||||
})
|
||||
|
||||
it('has correct element ids', () => {
|
||||
store.elements.forEach((el) => expect(['1', '2', 'e1-2']).to.include(el.id))
|
||||
store.nodes.forEach((el) => expect(['1', '2']).to.include(el.id))
|
||||
store.edges.forEach((el) => expect(['e1-2']).to.include(el.id))
|
||||
})
|
||||
|
||||
it('has correct element types', () => {
|
||||
store.elements.forEach((el) => expect(['input', 'default']).to.include(el.type))
|
||||
store.nodes.forEach((el) => expect(['input', 'default']).to.include(el.type))
|
||||
})
|
||||
|
||||
it('nodes have correct label', () => {
|
||||
|
||||
@@ -5,8 +5,8 @@ import { isEdge, isNode } from '~/utils'
|
||||
|
||||
describe('Render VueFlow', () => {
|
||||
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: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } },
|
||||
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 } },
|
||||
{ id: 'e1-2', source: '1', target: '2', animated: true },
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('Render VueFlow', () => {
|
||||
it('renders edges', () => cy.get('.vue-flow__edge').should('have.length', elements.filter(isEdge).length))
|
||||
|
||||
it('renders correct node labels', () =>
|
||||
cy.get('.vue-flow__node').each((node) => expect(elements.some((el) => el.data.label === node.text())).to.be.true))
|
||||
cy.get('.vue-flow__node').each((node) => expect(elements.some((el) => el.label === node.text())).to.be.true))
|
||||
|
||||
it('renders nodes at correct position', () =>
|
||||
cy.get('.vue-flow__node').each((node) => {
|
||||
|
||||
Reference in New Issue
Block a user