refractor code,

This commit is contained in:
root
2026-05-21 12:35:49 -04:00
parent e74681e810
commit f009ca10c6
158 changed files with 215801 additions and 5884 deletions
+51
View File
@@ -0,0 +1,51 @@
import { beforeAll, afterAll } from 'vitest'
import { prisma } from '../lib/prisma'
const delegates = [
'auditLog',
'adminPermission',
'adminUser',
'damagePoint',
'damageInspection',
'damageReport',
'additionalDriver',
'reservationInsurance',
'notificationPreference',
'notification',
'review',
'rentalPayment',
'reservation',
'customer',
'renterSavedCompany',
'renter',
'offerVehicle',
'offer',
'vehicleCalendarBlock',
'maintenanceLog',
'vehicle',
'employee',
'pricingRule',
'insurancePolicy',
'accountingSettings',
'contractSettings',
'brandSettings',
'subscriptionInvoice',
'subscription',
'company',
] as const
// Wipe all data between test files in a safe order that respects FK constraints.
async function cleanDatabase() {
for (const delegate of delegates) {
await (prisma as any)[delegate].deleteMany({})
}
}
beforeAll(async () => {
await cleanDatabase()
})
afterAll(async () => {
await cleanDatabase()
await prisma.$disconnect()
})