chore: Test performance (#5786)
This commit is contained in:
15
server/test/globalSetup.ts
Normal file
15
server/test/globalSetup.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import "./env";
|
||||
import { sequelize } from "@server/storage/database";
|
||||
|
||||
module.exports = async function () {
|
||||
const sql = sequelize.getQueryInterface();
|
||||
const tables = Object.keys(sequelize.models).map((model) => {
|
||||
const n = sequelize.models[model].getTableName();
|
||||
return (sql.queryGenerator as any).quoteTable(
|
||||
typeof n === "string" ? n : n.tableName
|
||||
);
|
||||
});
|
||||
const flushQuery = `TRUNCATE ${tables.join(", ")} CASCADE`;
|
||||
|
||||
await sequelize.query(flushQuery);
|
||||
};
|
||||
Reference in New Issue
Block a user