Skip to content
Snippets Groups Projects

Test onboarding categories components

Merged Agnethe Kval-Engstad requested to merge test-onboarding-categories-components into development
1 file
+ 60
0
Compare changes
  • Side-by-side
  • Inline
@@ -17,4 +17,64 @@ describe('Testing of OnboardingView', () => {
@@ -17,4 +17,64 @@ describe('Testing of OnboardingView', () => {
})
})
expect(wrapper.exists()).toBe(true)
expect(wrapper.exists()).toBe(true)
})
})
 
 
it('navigates to the previous step when clicking "Tilbake"', async () => {
 
const wrapper = mount(OnboardingView, {
 
global: {
 
stubs: ['RouterLink', 'Input', 'Button', 'Card', 'CardTitle', 'CardText']
 
},
 
mocks: {
 
$router: router
 
},
 
data() {
 
return {
 
step: 2
 
}
 
}
 
});
 
})
 
 
it('decrements step value when clicking "Tilbake"', async () => {
 
const wrapper = mount(OnboardingView, {
 
global: {
 
stubs: ['RouterLink', 'Input', 'Button', 'Card', 'CardTitle', 'CardText']
 
},
 
mocks: {
 
$router: router
 
},
 
data() {
 
return {
 
step: 2
 
}
 
}
 
});
 
 
const backButton = wrapper.find('[type="button"]');
 
await backButton.trigger('click');
 
 
expect(wrapper.vm.step).toBe(1); // Assuming step decrements correctly
 
});
 
 
it('does not decrement step value below 1 when clicking "Tilbake"', async () => {
 
const wrapper = mount(OnboardingView, {
 
global: {
 
stubs: ['RouterLink', 'Input', 'Button', 'Card', 'CardTitle', 'CardText']
 
},
 
mocks: {
 
$router: router
 
},
 
data() {
 
return {
 
step: 1
 
}
 
}
 
});
 
 
const backButton = wrapper.find('[type="button"]');
 
await backButton.trigger('click');
 
 
expect(wrapper.vm.step).toBe(1); // Step should remain 1 as it cannot go below
 
});
 
 
})
})
 
\ No newline at end of file
Loading