* 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
31 lines
803 B
TypeScript
31 lines
803 B
TypeScript
import { buildTeam, buildCollection } from "@server/test/factories";
|
|
import { getTestDatabase } from "@server/test/support";
|
|
|
|
const db = getTestDatabase();
|
|
|
|
afterAll(db.disconnect);
|
|
|
|
beforeEach(async () => {
|
|
await db.flush();
|
|
jest.resetAllMocks();
|
|
});
|
|
|
|
describe("collectionIds", () => {
|
|
it("should return non-private collection ids", async () => {
|
|
const team = await buildTeam();
|
|
const collection = await buildCollection({
|
|
teamId: team.id,
|
|
});
|
|
// build a collection in another team
|
|
await buildCollection();
|
|
// build a private collection
|
|
await buildCollection({
|
|
teamId: team.id,
|
|
permission: null,
|
|
});
|
|
const response = await team.collectionIds();
|
|
expect(response.length).toEqual(1);
|
|
expect(response[0]).toEqual(collection.id);
|
|
});
|
|
});
|