hrms-checkin/tests/utils.ts

27 lines
574 B
TypeScript
Raw Normal View History

2026-04-27 19:21:23 +07:00
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()
}