mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 19:58:44 +00:00
13 lines
306 B
TypeScript
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()
|
||
|
|
})
|
||
|
|
}
|