Skip to content
Snippets Groups Projects
Commit f91b7cc5 authored by Ingrid Martinsheimen Egge's avatar Ingrid Martinsheimen Egge :cow2:
Browse files

flere tester

parent 3ee31938
No related branches found
No related tags found
1 merge request!21Merge profilinnstillinger into main
Pipeline #225231 failed
......@@ -124,13 +124,10 @@ export default {
}).catch(error=> {
console.log(error)
if (error.message === '400') {
if(newRestricted){
this.alertMsg = '‼️Det oppsto en feil: Sørg for at det finnes mist en standard profil på kontoen‼️ '
} else if(this.updatedProfile.name !== this.initialName || this.updatedProfile.name) {
this.alertMsg = '‼️Det oppsto en feil: Det finnes allerede en bruker med samme navn‼️'
}
}else{
this.alertMsg = "‼️Det oppsto en feil.‼️"
......
......@@ -20,7 +20,7 @@ describe('EditProfile', () => {
const store = useAuthStore(pinia)
store.profile = {
name:"Ola",
restricted:false,
restricted:true,
profileImageUrl:"some/valid/image.png"
}
......@@ -29,4 +29,36 @@ describe('EditProfile', () => {
const unameInput = wrapper.find('#brukernavn');
expect(unameInput.element.value).to.contain('Ola');
})
it('If profile.restricted is true, then radio input with value false is not selected', () => {
const radioInput = wrapper.find('input[type=radio][value="false"]')
expect(radioInput.element.checked).toBe(false)
})
it('If profile.restricted is true, then radio input with valuetrue *is* selected', () => {
const radioInput = wrapper.find('input[type=radio][value="true"]')
expect(radioInput.element.checked).toBe(true)
})
//update the value from restricted true -> false
it('After changing restricted radio, the values are updated too', async () => {
const notRestrictedRadioInput = wrapper.find('#normal')
const restrictedRadioInput = wrapper.find('#restricted')
expect(notRestrictedRadioInput.element.checked).toBe(false)
expect(restrictedRadioInput.element.checked).toBe(true)
await notRestrictedRadioInput.trigger('click')
expect(notRestrictedRadioInput.element.checked).toBe(true)
expect(restrictedRadioInput.element.checked).toBe(false)
await wrapper.vm.$nextTick()
setTimeout(() => {
expect(wrapper.vm.updatedProfile.upRestricted).toBe(false)
}, 1000);
})
})
\ No newline at end of file
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