@craftguild/jscalendar 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -93,8 +93,8 @@ const task = new JsCal.Task({
|
|
|
93
93
|
title: "Write report",
|
|
94
94
|
start: "2026-02-11T09:00:00",
|
|
95
95
|
participants: JsCal.participants([
|
|
96
|
-
JsCal.Participant({ name: "Alice", email: "a@example.com" }),
|
|
97
|
-
JsCal.Participant({ name: "Bob" }),
|
|
96
|
+
JsCal.Participant({ name: "Alice", email: "a@example.com", roles: { attendee: true } }),
|
|
97
|
+
JsCal.Participant({ name: "Bob", roles: { attendee: true } }),
|
|
98
98
|
]),
|
|
99
99
|
locations: JsCal.locations([
|
|
100
100
|
JsCal.Location({ name: "Room A" }),
|
|
@@ -85,6 +85,22 @@ describe("validation", () => {
|
|
|
85
85
|
},
|
|
86
86
|
})).toThrowError("object.participants.p1.roles.attendee: must be true");
|
|
87
87
|
});
|
|
88
|
+
it("rejects participants without roles", () => {
|
|
89
|
+
expect(() => new JsCal.Event({
|
|
90
|
+
start: "2026-02-01T10:00:00",
|
|
91
|
+
participants: {
|
|
92
|
+
p1: { "@type": "Participant", name: "Alice" },
|
|
93
|
+
},
|
|
94
|
+
})).toThrowError("object.participants.p1.roles: is required");
|
|
95
|
+
});
|
|
96
|
+
it("rejects participants with empty roles", () => {
|
|
97
|
+
expect(() => new JsCal.Event({
|
|
98
|
+
start: "2026-02-01T10:00:00",
|
|
99
|
+
participants: {
|
|
100
|
+
p1: { "@type": "Participant", roles: {} },
|
|
101
|
+
},
|
|
102
|
+
})).toThrowError("object.participants.p1.roles: must include at least one role");
|
|
103
|
+
});
|
|
88
104
|
it("rejects invalid time zone ids", () => {
|
|
89
105
|
expect(() => new JsCal.Event({
|
|
90
106
|
start: "2026-02-01T10:00:00",
|
|
@@ -191,8 +191,13 @@ export function validateParticipant(value, path) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
assertString(value.kind, `${path}.kind`);
|
|
194
|
-
if (value.roles)
|
|
195
|
-
|
|
194
|
+
if (!value.roles) {
|
|
195
|
+
fail(`${path}.roles`, "is required");
|
|
196
|
+
}
|
|
197
|
+
assertBooleanMap(value.roles, `${path}.roles`);
|
|
198
|
+
if (Object.keys(value.roles).length === 0) {
|
|
199
|
+
fail(`${path}.roles`, "must include at least one role");
|
|
200
|
+
}
|
|
196
201
|
assertId(value.locationId, `${path}.locationId`);
|
|
197
202
|
assertString(value.language, `${path}.language`);
|
|
198
203
|
assertString(value.participationStatus, `${path}.participationStatus`);
|