Files
shumai/src/db-test-hooks.ts
T

13 lines
306 B
TypeScript
Raw Normal View History

2026-05-19 16:05:09 +08:00
import { afterEach, beforeEach } from 'vitest'
import { getPrismaTestingHelper } from '@/db'
export function setupTestDbHooks() {
beforeEach(async () => {
await getPrismaTestingHelper().startNewTransaction()
})
afterEach(() => {
getPrismaTestingHelper().rollbackCurrentTransaction()
})
}