Updated tests

This commit is contained in:
2026-03-18 21:52:04 +00:00
parent 11a752a6b2
commit a7574d2a93
4 changed files with 72 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { mount } from '@vue/test-utils'
import { createVuetify } from 'vuetify'
import { createRouter, createWebHistory } from 'vue-router'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import Uploader from "@/pages/uploader.vue"
@@ -21,6 +22,11 @@ vi.stubGlobal('useRouter', () => mockRouter)
const mockFetch = vi.fn()
vi.stubGlobal('$fetch', mockFetch)
const router = createRouter({
history: createWebHistory(),
routes: [],
})
describe('Uploader.vue', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -28,7 +34,7 @@ describe('Uploader.vue', () => {
const mountOptions = {
global: {
plugins: [vuetify],
plugins: [vuetify, router],
stubs: { RecipeDisplay: true },
provide: { 'router': mockRouter }
}
@@ -71,4 +77,5 @@ describe('Uploader.vue', () => {
expect(vm.recipe.title).toBe('Restored Cake')
expect(localStorage.getItem('pending_recipe')).toBeNull()
})
})