refactor code & fixed location
This commit is contained in:
parent
41c1aa8e45
commit
487a6b520e
23 changed files with 566 additions and 145 deletions
26
tests/utils.ts
Normal file
26
tests/utils.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { enableAutoUnmount, flushPromises, VueWrapper } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
|
||||
/**
|
||||
* Helper function to setup test environment with Pinia
|
||||
*/
|
||||
export function setupTest() {
|
||||
const pinia = createPinia()
|
||||
setActivePinia(pinia)
|
||||
return pinia
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to flush all pending promises
|
||||
*/
|
||||
export async function flushAllPromises() {
|
||||
await flushPromises()
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to cleanup after each test
|
||||
*/
|
||||
export function teardownTest() {
|
||||
vi.clearAllMocks()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue