Skip to content
Snippets Groups Projects
Commit d1928379 authored by Sverre Frogner Haugen's avatar Sverre Frogner Haugen
Browse files

Added rendering unit test to PasswordInfo componenet

parent 0df94e8e
No related branches found
No related tags found
1 merge request!67Profile components unit tests
Pipeline #281201 passed
import { mount } from '@vue/test-utils'
import PasswordInfo from '@/components/profile/PasswordInfo.vue'
import { describe, it, expect, beforeEach } from 'vitest'
import { createPinia, setActivePinia } from 'pinia'
describe('PasswordComponent', () => {
beforeEach(() => {
setActivePinia(createPinia());
});
it('renders correctly', async () => {
const wrapper = mount(PasswordInfo)
expect(wrapper.exists()).toBe(true)
expect(wrapper.find('.title').text()).toBe('Passord')
expect(wrapper.find('.save-button').exists()).toBe(true)
expect(wrapper.find('[data-testid="current-password-input"]').exists()).toBe(true)
expect(wrapper.find('[data-testid="new-password-input"]').exists()).toBe(true)
})
})
......@@ -73,7 +73,8 @@ const clearInput = () => {
<input class="input"
:class="{'error': currentPasswordError}"
type="password"
v-model="currentPassword">
v-model="currentPassword"
data-testid="current-password-input">
<div class="alert-box">
<h4 v-if="currentPasswordError" class="error-message">{{currentPasswordError}}</h4>
</div>
......@@ -84,7 +85,8 @@ const clearInput = () => {
<input class="input"
:class="{'error': newPasswordError}"
type="password"
v-model="newPassword">
v-model="newPassword"
data-testid="new-password-input">
<div class="alert-box">
<h4 v-if="newPasswordError" class="error-message">{{newPasswordError}}</h4>
<h4 v-if="passwordError" class="error-message">{{passwordError}}</h4>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment