2021-11-29 06:40:55 -08:00
|
|
|
import { buildTeam, buildCollection } from "@server/test/factories";
|
2022-01-06 18:24:28 -08:00
|
|
|
|
2025-02-18 19:53:18 -05:00
|
|
|
describe("Team", () => {
|
|
|
|
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);
|
2021-11-29 06:40:55 -08:00
|
|
|
});
|
2025-02-18 19:53:18 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("previousSubdomains", () => {
|
|
|
|
it("should list the previous subdomains", async () => {
|
|
|
|
const team = await buildTeam({
|
|
|
|
subdomain: "example",
|
|
|
|
});
|
|
|
|
const subdomain = "updated";
|
|
|
|
|
|
|
|
await team.update({ subdomain });
|
|
|
|
expect(team.subdomain).toEqual(subdomain);
|
|
|
|
expect(team.previousSubdomains?.length).toEqual(1);
|
|
|
|
expect(team.previousSubdomains?.[0]).toEqual("example");
|
|
|
|
|
|
|
|
const subdomain2 = "another";
|
|
|
|
await team.update({ subdomain: subdomain2 });
|
|
|
|
expect(team.subdomain).toEqual(subdomain2);
|
|
|
|
expect(team.previousSubdomains?.length).toEqual(2);
|
|
|
|
expect(team.previousSubdomains?.[0]).toEqual("example");
|
|
|
|
expect(team.previousSubdomains?.[1]).toEqual(subdomain);
|
2021-11-29 06:40:55 -08:00
|
|
|
});
|
2021-03-30 21:02:08 -07:00
|
|
|
});
|
2018-11-12 14:00:23 -08:00
|
|
|
});
|