* 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
27 lines
740 B
TypeScript
27 lines
740 B
TypeScript
import { buildUser, buildTeam } from "@server/test/factories";
|
|
import { getTestDatabase } from "@server/test/support";
|
|
import { serialize } from "./index";
|
|
|
|
const db = getTestDatabase();
|
|
|
|
afterAll(db.disconnect);
|
|
|
|
beforeEach(db.flush);
|
|
|
|
it("should serialize policy", async () => {
|
|
const user = await buildUser();
|
|
const response = serialize(user, user);
|
|
expect(response.update).toEqual(true);
|
|
expect(response.delete).toEqual(true);
|
|
});
|
|
|
|
it("should serialize domain policies on Team", async () => {
|
|
const team = await buildTeam();
|
|
const user = await buildUser({
|
|
teamId: team.id,
|
|
});
|
|
const response = serialize(user, team);
|
|
expect(response.createDocument).toEqual(true);
|
|
expect(response.inviteUser).toEqual(false);
|
|
});
|