#602 adminstrator can manage calendar resources (#703)

Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
lethemanh
2026-03-25 14:28:24 +07:00
committed by GitHub
parent fdc9d7651b
commit 43424607d4
21 changed files with 237 additions and 36 deletions
@@ -129,4 +129,55 @@ describe("AttendanceValidation - delegation", () => {
expect(container.firstChild).not.toBeNull();
});
});
describe("resource calendar", () => {
const resourceContext = makeContext({
isOwn: false,
calendar: {
id: "res1/cal1",
name: "Resource Cal",
delegated: false,
owner: {
emails: ["resource@example.com"],
resource: true,
administrators: [{ id: "admin1" }],
},
events: {},
} as Calendar,
});
it("renders when user is an administrator of the resource", () => {
const { getByText } = render(
<AttendanceValidation
contextualizedEvent={resourceContext}
user={
{
...makeUser("admin@example.com"),
openpaasId: "admin1",
} as userData
}
setAfterChoiceFunc={noopSetFunc}
setOpenEditModePopup={noopSetFunc}
/>
);
expect(getByText("eventPreview.authorizeQuestion")).toBeTruthy();
});
it("returns null when user is not an administrator of the resource", () => {
const { container } = render(
<AttendanceValidation
contextualizedEvent={resourceContext}
user={
{
...makeUser("other@example.com"),
openpaasId: "other1",
} as userData
}
setAfterChoiceFunc={noopSetFunc}
setOpenEditModePopup={noopSetFunc}
/>
);
expect(container.firstChild).toBeNull();
});
});
});