From 0df94e8e9f024964286c983256c91f849aa99e4f Mon Sep 17 00:00:00 2001 From: Sverre <sverrefh@stud.ntnu.no> Date: Tue, 30 Apr 2024 08:58:35 +0200 Subject: [PATCH] Wrote rendering unit test for IncomeInfo component --- src/components/__tests__/IncomeInfo.spec.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/components/__tests__/IncomeInfo.spec.ts diff --git a/src/components/__tests__/IncomeInfo.spec.ts b/src/components/__tests__/IncomeInfo.spec.ts new file mode 100644 index 0000000..779f8b3 --- /dev/null +++ b/src/components/__tests__/IncomeInfo.spec.ts @@ -0,0 +1,21 @@ +import { mount } from '@vue/test-utils'; +import IncomeInfo from '@/components/profile/IncomeInfo.vue' +import { describe, it, expect, beforeEach } from 'vitest' +import { createPinia, setActivePinia } from 'pinia' + +describe('IncomeInfo', () => { + + beforeEach(() => { + setActivePinia(createPinia()); + }); + + it('renders correctly', async () => { + const wrapper = mount(IncomeInfo); + + expect(wrapper.exists()).toBe(true); + + expect(wrapper.findAll('.input-field')).toHaveLength(3); + + expect(wrapper.find('.save-button').exists()).toBe(true); + }); +}); -- GitLab