Skip to content
Snippets Groups Projects

Accept preview challenge component

8 files
+ 293
13
Compare changes
  • Side-by-side
  • Inline
Files
8
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import AcceptPreviewChallenge from "@/components/AcceptPreviewChallenge.vue";
describe('Choose Saving Challenge: Component testing', () => {
it('renders the component', () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
expect(wrapper.exists()).toBe(true)
})
it('button for accepting challenge is rendered', () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
expect(wrapper.find('#accept').text()).toBe('Aksepter')
})
it('button for declining challenge is rendered', () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
expect(wrapper.find('#decline').text()).toBe('Avvis')
})
it('updates time when updateTime is called with 7', async () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
await wrapper.vm.updateTime(7)
expect(wrapper.vm.time).toBe(7)
})
it('updates time when updateTime is called with 14', async () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
await wrapper.vm.updateTime(14)
expect(wrapper.vm.time).toBe(14)
})
it('updates time when updateTime is called with 30', async () => {
const wrapper = mount(AcceptPreviewChallenge,
{global: {
stubs: ['RouterLink']
}
})
await wrapper.vm.updateTime(30)
expect(wrapper.vm.time).toBe(30)
})
})
\ No newline at end of file
Loading