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

13 lines
309 B
TypeScript

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