Individual document sharing with permissions (#5814)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
This commit is contained in:
Apoorv Mishra
2024-01-31 07:18:22 +05:30
committed by GitHub
parent 717c9b5d64
commit 1490c3a14b
91 changed files with 4004 additions and 1166 deletions

View File

@@ -0,0 +1,28 @@
import { buildCollection, buildUser } from "@server/test/factories";
import UserMembership from "./UserMembership";
describe("UserMembership", () => {
describe("withCollection scope", () => {
it("should return the collection", async () => {
const collection = await buildCollection();
const user = await buildUser({ teamId: collection.teamId });
await UserMembership.create({
createdById: user.id,
userId: user.id,
collectionId: collection.id,
});
const membership = await UserMembership.scope("withCollection").findOne({
where: {
userId: user.id,
collectionId: collection.id,
},
});
expect(membership).toBeDefined();
expect(membership?.collection).toBeDefined();
expect(membership?.collection?.id).toEqual(collection.id);
});
});
});