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

@@ -137,7 +137,10 @@ describe("revisions.create", () => {
const collaborator0 = await buildUser();
const collaborator1 = await buildUser({ teamId: collaborator0.teamId });
const collaborator2 = await buildUser({ teamId: collaborator0.teamId });
const document = await buildDocument({ userId: collaborator0.id });
const document = await buildDocument({
teamId: collaborator0.teamId,
userId: collaborator0.id,
});
await Revision.createFromDocument(document);
document.text = "Updated body content";
document.updatedAt = new Date();
@@ -159,7 +162,11 @@ describe("revisions.create", () => {
ip,
});
const events = await Event.findAll();
const events = await Event.findAll({
where: {
teamId: document.teamId,
},
});
// Should emit 3 `subscriptions.create` events.
expect(events.length).toEqual(3);
@@ -254,7 +261,11 @@ describe("revisions.create", () => {
ip,
});
const events = await Event.findAll();
const events = await Event.findAll({
where: {
teamId: document.teamId,
},
});
// Should emit 2 `subscriptions.create` events.
expect(events.length).toEqual(2);