64 lines
1.6 KiB
JavaScript
64 lines
1.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const vitest_1 = require("vitest");
|
|
const prisma_1 = require("../lib/prisma");
|
|
const delegates = [
|
|
'billingEvent',
|
|
'billingRefund',
|
|
'billingCreditNote',
|
|
'billingCreditLedgerEntry',
|
|
'billingCreditBalance',
|
|
'billingPaymentAttempt',
|
|
'billingPaymentIntent',
|
|
'billingInvoiceLineItem',
|
|
'billingInvoice',
|
|
'billingPaymentMethod',
|
|
'billingAccount',
|
|
'auditLog',
|
|
'adminPermission',
|
|
'adminUser',
|
|
'damagePoint',
|
|
'damageInspection',
|
|
'damageReport',
|
|
'additionalDriver',
|
|
'reservationInsurance',
|
|
'notificationPreference',
|
|
'notification',
|
|
'review',
|
|
'rentalPayment',
|
|
'reservation',
|
|
'customer',
|
|
'renterSavedCompany',
|
|
'renter',
|
|
'offerVehicle',
|
|
'offer',
|
|
'vehicleCalendarBlock',
|
|
'vehiclePriceHistory',
|
|
'vehiclePricingRule',
|
|
'vehiclePricingConfiguration',
|
|
'maintenanceLog',
|
|
'vehicle',
|
|
'employee',
|
|
'pricingRule',
|
|
'insurancePolicy',
|
|
'accountingSettings',
|
|
'contractSettings',
|
|
'brandSettings',
|
|
'subscriptionInvoice',
|
|
'subscription',
|
|
'company',
|
|
];
|
|
// Wipe all data between test files in a safe order that respects FK constraints.
|
|
async function cleanDatabase() {
|
|
for (const delegate of delegates) {
|
|
await prisma_1.prisma[delegate].deleteMany({});
|
|
}
|
|
}
|
|
(0, vitest_1.beforeAll)(async () => {
|
|
await cleanDatabase();
|
|
});
|
|
(0, vitest_1.afterAll)(async () => {
|
|
await cleanDatabase();
|
|
await prisma_1.prisma.$disconnect();
|
|
});
|
|
//# sourceMappingURL=setup.js.map
|