import { config } from '@vue/test-utils' import { vi } from 'vitest' import * as Vue from 'vue' // Mock localStorage with actual implementation class LocalStorageMock { private store: Map = new Map() getItem(key: string): string | null { return this.store.get(key) ?? null } setItem(key: string, value: string): void { this.store.set(key, value) } removeItem(key: string): void { this.store.delete(key) } clear(): void { this.store.clear() } key(index: number): string | null { return Array.from(this.store.keys())[index] ?? null } get length(): number { return this.store.size } } global.localStorage = new LocalStorageMock() as unknown as Storage // Make Vue composables globally available global.ref = Vue.ref global.computed = Vue.computed global.reactive = Vue.reactive global.watch = Vue.watch global.watchEffect = Vue.watchEffect global.defineModel = Vue.defineModel global.onMounted = Vue.onMounted global.onUnmounted = Vue.onUnmounted global.nextTick = Vue.nextTick // Mock Nuxt composables global.useRuntimeConfig = vi.fn(() => ({ public: {}, })) global.useNuxtApp = vi.fn(() => ({ $apollo: {}, })) global.navigateTo = vi.fn() global.definePageMeta = vi.fn() // Mock Vuetify components globally for tests config.global.stubs = { VAlert: { name: 'v-alert', template: '
', props: ['color', 'type', 'variant'], }, VTextField: { template: '
', props: ['modelValue', 'readonly', 'disabled', 'active', 'focused', 'variant', 'error', 'errorMessages', 'label'], emits: ['update:model-value', 'blur'], }, VBtn: { name: 'v-btn', template: '', props: ['disabled', 'variant', 'icon', 'color', 'flat', 'depressed', 'xLarge'], emits: ['click'], }, VDialog: { name: 'v-dialog', template: '
', props: ['modelValue', 'width', 'maxWidth', 'persistent'], }, VForm: { name: 'v-form', template: '
', emits: ['submit'], }, VCard: { name: 'v-card', template: '
{{ title }}
', props: ['variant', 'rounded', 'loading', 'title'], }, VCardTitle: { template: '
', }, VCardText: { name: 'v-card-text', template: '
', }, VCardActions: { name: 'v-card-actions', template: '
', }, VSpacer: { name: 'v-spacer', template: '
', }, VIcon: { name: 'v-icon', template: '', props: ['icon', 'large', 'start', 'end', 'size'], emits: ['click'], }, VMenu: { name: 'v-menu', template: '
', props: ['modelValue', 'closeOnContentClick'], }, VList: { name: 'v-list', template: '
', }, VListItem: { name: 'v-list-item', template: '
', props: ['active', 'value'], emits: ['click'], }, VListItemTitle: { name: 'v-list-item-title', template: '
', }, VChip: { name: 'v-chip', template: '
', props: ['size', 'variant', 'prependIcon'], }, }