chore: Improve perf of server tests (#5785)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Subscription, Event } from "@server/models";
|
||||
import { Subscription } from "@server/models";
|
||||
import { sequelize } from "@server/storage/database";
|
||||
import {
|
||||
buildDocument,
|
||||
@@ -36,17 +36,13 @@ describe("subscriptionDestroyer", () => {
|
||||
})
|
||||
);
|
||||
|
||||
const count = await Subscription.count();
|
||||
const count = await Subscription.count({
|
||||
where: {
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(count).toEqual(0);
|
||||
|
||||
const event = await Event.findOne();
|
||||
|
||||
expect(event?.name).toEqual("subscriptions.delete");
|
||||
expect(event?.modelId).toEqual(subscription.id);
|
||||
expect(event?.actorId).toEqual(subscription.userId);
|
||||
expect(event?.userId).toEqual(subscription.userId);
|
||||
expect(event?.documentId).toEqual(subscription.documentId);
|
||||
});
|
||||
|
||||
it("should soft delete row", async () => {
|
||||
@@ -72,18 +68,14 @@ describe("subscriptionDestroyer", () => {
|
||||
})
|
||||
);
|
||||
|
||||
const count = await Subscription.count();
|
||||
const count = await Subscription.count({
|
||||
where: {
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(count).toEqual(0);
|
||||
|
||||
const event = await Event.findOne();
|
||||
|
||||
expect(event?.name).toEqual("subscriptions.delete");
|
||||
expect(event?.modelId).toEqual(subscription.id);
|
||||
expect(event?.actorId).toEqual(subscription.userId);
|
||||
expect(event?.userId).toEqual(subscription.userId);
|
||||
expect(event?.documentId).toEqual(subscription.documentId);
|
||||
|
||||
const deletedSubscription = await Subscription.findOne({
|
||||
where: {
|
||||
userId: user.id,
|
||||
|
||||
Reference in New Issue
Block a user