Files
shumai/src/db-test-hooks.ts
T
2026-05-19 16:05:09 +08:00

13 lines
306 B
TypeScript

import { afterEach, beforeEach } from 'vitest'
import { getPrismaTestingHelper } from '@/db'
export function setupTestDbHooks() {
beforeEach(async () => {
await getPrismaTestingHelper().startNewTransaction()
})
afterEach(() => {
getPrismaTestingHelper().rollbackCurrentTransaction()
})
}