* perf: reduce memory usage upon running server tests * perf: plug leaks in server/routes * perf: plug leaks in server/scripts * perf: plug leaks in server/policies * perf: plug leaks in server/models * perf: plug leaks in server/middlewares * perf: plug leaks in server/commands * fix: missing await on db.flush * perf: plug leaks in server/queues * chore: remove unused legacy funcs * fix: await on db.flush * perf: await on GC to run in between tests * fix: remove db refs * fix: revert embeds * perf: plug leaks in shared/i18n
25 lines
694 B
TypeScript
25 lines
694 B
TypeScript
import { FileOperation } from "@server/models";
|
|
import { buildAdmin, buildFileOperation } from "@server/test/factories";
|
|
import { getTestDatabase } from "@server/test/support";
|
|
import fileOperationDeleter from "./fileOperationDeleter";
|
|
|
|
const db = getTestDatabase();
|
|
|
|
afterAll(db.disconnect);
|
|
|
|
beforeEach(db.flush);
|
|
|
|
describe("fileOperationDeleter", () => {
|
|
const ip = "127.0.0.1";
|
|
|
|
it("should destroy file operation", async () => {
|
|
const admin = await buildAdmin();
|
|
const fileOp = await buildFileOperation({
|
|
userId: admin.id,
|
|
teamId: admin.teamId,
|
|
});
|
|
await fileOperationDeleter(fileOp, admin, ip);
|
|
expect(await FileOperation.count()).toEqual(0);
|
|
});
|
|
});
|