feat(gro-107): add CalendarSync UI component and calendar unit tests

- Add CalendarSync component with generate/revoke/copy functionality
- Add unit tests for generateIcalToken function
- Fix StaffRow type in petPhotos.test.ts and rbac.test.ts to include icalToken

The CalendarSync component can be added to a staff profile/settings page.
Currently the Staff page (admin/staff) does not have a profile section
for individual staff - integration will need a new route or profile section.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Scrubs McBarkley
2026-03-25 06:59:44 +00:00
parent 5b1a8858f3
commit c5977ef573
5 changed files with 198 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { describe, it, expect } from "vitest";
import { generateIcalToken } from "../routes/calendar.js";
describe("generateIcalToken", () => {
it("generates a 64-character hex token", () => {
const token = generateIcalToken();
expect(token).toHaveLength(64);
expect(token).toMatch(/^[a-f0-9]+$/);
});
it("generates unique tokens", () => {
const token1 = generateIcalToken();
const token2 = generateIcalToken();
expect(token1).not.toBe(token2);
});
});
+1
View File
@@ -11,6 +11,7 @@ const MANAGER: StaffRow = {
name: "Manager McManager",
email: "manager@example.com",
active: true,
icalToken: null,
createdAt: new Date(),
updatedAt: new Date(),
};
+1
View File
@@ -12,6 +12,7 @@ const MANAGER: StaffRow = {
name: "Manager McManager",
email: "manager@example.com",
active: true,
icalToken: null,
createdAt: new Date(),
updatedAt: new Date(),
};