refactor code & fixed location

This commit is contained in:
Warunee Tamkoo 2026-04-27 19:21:23 +07:00
parent 41c1aa8e45
commit 487a6b520e
23 changed files with 566 additions and 145 deletions

26
tests/utils.ts Normal file
View 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()
}