diff --git a/src/components/general/ProfitSymbol.cy.ts b/src/components/general/ProfitSymbol.cy.ts deleted file mode 100644 index aaa28d15..00000000 --- a/src/components/general/ProfitSymbol.cy.ts +++ /dev/null @@ -1,15 +0,0 @@ -import ProfitSymbol from '@/components/general/ProfitSymbol.vue'; - -describe('ProfitSymbol.vue', () => { - it('calculates isProfitable with negative profit', () => { - cy.mount(ProfitSymbol, { props: { profit: -0.5 } }); - - cy.get('div').should('have.class', 'triangle-down'); - cy.get('div').should('not.have.class', 'triangle-up'); - }); - it('calculates isProfitable with positive profit', () => { - cy.mount(ProfitSymbol, { props: { profit: 0.5 } }); - cy.get('div').should('have.class', 'triangle-up'); - cy.get('div').should('not.have.class', 'triangle-down'); - }); -}); diff --git a/tests/component/ProfitSymbol.spec.ts b/tests/component/ProfitSymbol.spec.ts new file mode 100644 index 00000000..289455ee --- /dev/null +++ b/tests/component/ProfitSymbol.spec.ts @@ -0,0 +1,20 @@ +import ProfitSymbol from '@/components/general/ProfitSymbol.vue'; +import { mount } from '@vue/test-utils'; +import { describe, expect, it } from 'vitest'; + +describe('ProfitSymbol.vue', () => { + it('calculates isProfitable with negative profit', () => { + const wrapper = mount(ProfitSymbol, { props: { profit: -0.5 } }); + const divs = wrapper.findAll('div'); + expect(divs[1].classes()).toContain('triangle-down'); + expect(divs[1].classes()).not.toContain('triangle-up'); + }); + + it('calculates isProfitable with positive profit', () => { + const wrapper = mount(ProfitSymbol, { props: { profit: 0.5 } }); + + const divs = wrapper.findAll('div'); + expect(divs[1].classes()).not.toContain('triangle-down'); + expect(divs[1].classes()).toContain('triangle-up'); + }); +});