chore: Improve perf of server tests (#5785)

This commit is contained in:
Tom Moor
2023-09-06 07:14:49 -04:00
committed by GitHub
parent a724a21c21
commit 3eb947e9a5
69 changed files with 2045 additions and 1551 deletions

View File

@@ -1,6 +1,6 @@
import { Comment, Event } from "@server/models";
import { Comment } from "@server/models";
import { buildDocument, buildUser } from "@server/test/factories";
import { setupTestDatabase } from "@server/test/support";
import { findLatestEvent, setupTestDatabase } from "@server/test/support";
import commentDestroyer from "./commentDestroyer";
setupTestDatabase();
@@ -41,10 +41,14 @@ describe("commentDestroyer", () => {
ip,
});
const count = await Comment.count();
const count = await Comment.count({
where: {
id: comment.id,
},
});
expect(count).toEqual(0);
const event = await Event.findOne();
const event = await findLatestEvent();
expect(event!.name).toEqual("comments.delete");
expect(event!.modelId).toEqual(comment.id);
});