[#69] added secret link for calendars (#284)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
Co-authored-by: Benoit TELLIER <btellier@linagora.com>
This commit is contained in:
Camille Moussu
2025-11-07 08:30:47 +01:00
committed by GitHub
parent 0647be551f
commit daed6d97ed
6 changed files with 187 additions and 22 deletions
@@ -4,6 +4,7 @@ import {
addSharedCalendar,
getCalendar,
getCalendars,
getSecretLink,
postCalendar,
proppatchCalendar,
removeCalendar,
@@ -114,6 +115,40 @@ describe("Calendar API", () => {
});
});
it("get secret link ", async () => {
const calLink = "/calendars/calId.json";
(api.get as jest.Mock).mockReturnValue({
json: jest.fn().mockResolvedValue("link"),
});
const noreset = await getSecretLink(calLink, false);
expect(api.get).toHaveBeenCalledWith(
`calendar/api${calLink}/secret-link?shouldResetLink=false`,
{
headers: {
Accept: "application/json, text/plain, */*",
},
}
);
});
it("get secret link ", async () => {
const calLink = "/calendars/calId.json";
(api.get as jest.Mock).mockReturnValue({
json: jest.fn().mockResolvedValue("link"),
});
const reset = await getSecretLink(calLink, true);
expect(api.get).toHaveBeenCalledWith(
`calendar/api${calLink}/secret-link?shouldResetLink=true`,
{
headers: {
Accept: "application/json, text/plain, */*",
},
}
);
});
it("When adding a sharedCal with #default as a name a new name is sent to the back", async () => {
const mockApiPost = jest.spyOn(api, "post");