fix frontend test debt
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { setActivePinia, createPinia } from 'pinia'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createRouter, createMemoryHistory } from 'vue-router'
|
||||
import MainLayout from '../MainLayout.vue'
|
||||
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: (query: string) => ({
|
||||
matches: false, media: query, onchange: null,
|
||||
addListener: () => {}, removeListener: () => {},
|
||||
addEventListener: () => {}, removeEventListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
}),
|
||||
})
|
||||
|
||||
function createTestRouter() {
|
||||
return createRouter({
|
||||
history: createMemoryHistory(),
|
||||
@@ -17,6 +28,7 @@ function createTestRouter() {
|
||||
|
||||
describe('MainLayout', () => {
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia())
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user