update cal details (#113)

* [#65] added button to access cal details

* [#65] added proppatch call

* [#65] added tests

* fixup! [#65] added proppatch call

* [#65] added trimming to name and desc

* fixup! [#65] added proppatch call

* fixup! [#65] added proppatch call

* fixup! [#65] added proppatch call

---------

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-09-17 15:05:27 +02:00
committed by GitHub
parent 5522673342
commit f640cac8ac
8 changed files with 358 additions and 85 deletions
@@ -4,6 +4,7 @@ import {
getCalendar,
getCalendars,
postCalendar,
proppatchCalendar,
} from "../../../src/features/Calendars/CalendarApi";
import { clientConfig } from "../../../src/features/User/oidcAuth";
import { api } from "../../../src/utils/apiUtils";
@@ -77,4 +78,25 @@ describe("Calendar API", () => {
}),
});
});
it("patch Calendar", async () => {
const calId = "calId";
const calLink = "/calendars/calId.json";
const color = "calId";
const name = "new cal";
const desc = "desc";
const result = await proppatchCalendar(calLink, { color, name, desc });
expect(api).toHaveBeenCalledWith(`dav${calLink}`, {
method: "PROPPATCH",
headers: {
Accept: "application/json, text/plain, */*",
},
body: JSON.stringify({
"dav:name": "new cal",
"caldav:description": "desc",
"apple:color": "calId",
}),
});
});
});