@remit/backend 0.0.97 → 0.0.99
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/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
deleteCalendarObject,
|
|
16
16
|
listBusySpans,
|
|
17
17
|
listCalendarInstances,
|
|
18
|
+
OFFSET_BEARING,
|
|
18
19
|
parseCalendar,
|
|
19
20
|
projectCalendar,
|
|
20
21
|
putCalendarObject,
|
|
@@ -90,7 +91,12 @@ export const readWindow = (
|
|
|
90
91
|
}
|
|
91
92
|
const fromMs = Date.parse(from);
|
|
92
93
|
const toMs = Date.parse(to);
|
|
93
|
-
if (
|
|
94
|
+
if (
|
|
95
|
+
Number.isNaN(fromMs) ||
|
|
96
|
+
Number.isNaN(toMs) ||
|
|
97
|
+
!OFFSET_BEARING.test(from) ||
|
|
98
|
+
!OFFSET_BEARING.test(to)
|
|
99
|
+
) {
|
|
94
100
|
return refuseCalendar(
|
|
95
101
|
"InvalidWindow",
|
|
96
102
|
"`from` and `to` must be ISO 8601 date-times with a zone offset",
|
|
@@ -308,6 +308,27 @@ describe("readWindow", () => {
|
|
|
308
308
|
);
|
|
309
309
|
});
|
|
310
310
|
|
|
311
|
+
it("refuses an end that carries no zone offset", () => {
|
|
312
|
+
const wallTime = readWindow("2026-01-01T00:00:00", "2026-01-08T00:00:00Z");
|
|
313
|
+
assert.ok(!wallTime.ok);
|
|
314
|
+
assert.equal(wallTime.error.code, "InvalidWindow");
|
|
315
|
+
|
|
316
|
+
const dateOnly = readWindow("2026-01-01T00:00:00Z", "2026-01-08");
|
|
317
|
+
assert.ok(!dateOnly.ok);
|
|
318
|
+
assert.equal(dateOnly.error.code, "InvalidWindow");
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("accepts either spelling of an offset", () => {
|
|
322
|
+
assert.equal(
|
|
323
|
+
readWindow("2026-01-01T00:00:00Z", "2026-01-08T00:00:00Z").ok,
|
|
324
|
+
true,
|
|
325
|
+
);
|
|
326
|
+
assert.equal(
|
|
327
|
+
readWindow("2026-01-01T00:00:00+02:00", "2026-01-08T00:00:00+02:00").ok,
|
|
328
|
+
true,
|
|
329
|
+
);
|
|
330
|
+
});
|
|
331
|
+
|
|
311
332
|
it("normalises both ends to UTC instants", () => {
|
|
312
333
|
const window = readWindow(
|
|
313
334
|
"2026-09-07T02:00:00+02:00",
|
|
@@ -33,9 +33,7 @@ process.stdout.write = ((
|
|
|
33
33
|
|
|
34
34
|
process.env.LOG_LEVEL = "trace";
|
|
35
35
|
|
|
36
|
-
const {
|
|
37
|
-
"@remit/calendar-service"
|
|
38
|
-
);
|
|
36
|
+
const { mintCalendarFeedToken } = await import("@remit/calendar-service");
|
|
39
37
|
const { _resetForTest, setClient } = await import("./service/data-client.js");
|
|
40
38
|
const { createCalendarSqliteClient } = await import(
|
|
41
39
|
"./handlers/calendar-sqlite-fixture.js"
|
|
@@ -96,7 +94,7 @@ describe("what a request leaves in the log", () => {
|
|
|
96
94
|
const { token } = mintCalendarFeedToken();
|
|
97
95
|
|
|
98
96
|
const { response, logged } = await capture(() =>
|
|
99
|
-
send({ httpMethod: "GET", path:
|
|
97
|
+
send({ httpMethod: "GET", path: `/feeds/calendar/${token}.ics` }),
|
|
100
98
|
);
|
|
101
99
|
|
|
102
100
|
assert.equal(
|