Marc Roig d4d47227a6
feat: Initialize Document Service (#18558)
Co-authored-by: Ben Irvin <ben@innerdvations.com>
2023-11-28 12:01:27 +01:00

12 lines
422 B
TypeScript

// Note: any tests that would cause writes to the db should be wrapped with this method to prevent changes
// Alternatively, we could truncate/insert the tables in afterEach which should be only marginally slower
// TODO: move to utils
export const testInTransaction = (test) => {
return async () => {
await strapi.db.transaction(async ({ rollback }) => {
await test();
await rollback();
});
};
};