forked from GitHubMirrors/silverbullet-icalendar
conductor(checkpoint): Checkpoint end of Phase 2: Core Logic
This commit is contained in:
45
icalendar_test.ts
Normal file
45
icalendar_test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { assertEquals } from "jsr:@std/assert";
|
||||
import { resolveEventStart } from "./icalendar.ts";
|
||||
|
||||
Deno.test("resolveEventStart - local date with timezone", async () => {
|
||||
const icsEvent = {
|
||||
summary: "Test Event",
|
||||
start: {
|
||||
date: "2025-01-15T12:00:00.000",
|
||||
local: {
|
||||
date: "2025-01-15T07:00:00.000",
|
||||
timezone: "Eastern Standard Time"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const result = await resolveEventStart(icsEvent);
|
||||
assertEquals(result?.toISOString(), "2025-01-15T12:00:00.000Z");
|
||||
});
|
||||
|
||||
Deno.test("resolveEventStart - DST check (Summer)", async () => {
|
||||
const icsEvent = {
|
||||
summary: "Test Event DST",
|
||||
start: {
|
||||
date: "2025-07-15T11:00:00.000",
|
||||
local: {
|
||||
date: "2025-07-15T07:00:00.000",
|
||||
timezone: "Eastern Standard Time"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const result = await resolveEventStart(icsEvent);
|
||||
assertEquals(result?.toISOString(), "2025-07-15T11:00:00.000Z");
|
||||
});
|
||||
|
||||
Deno.test("resolveEventStart - UTC event", async () => {
|
||||
const icsEvent = {
|
||||
summary: "UTC Event",
|
||||
start: {
|
||||
date: "2025-01-15T12:00:00.000Z"
|
||||
}
|
||||
};
|
||||
const result = await resolveEventStart(icsEvent);
|
||||
assertEquals(result?.toISOString(), "2025-01-15T12:00:00.000Z");
|
||||
});
|
||||
Reference in New Issue
Block a user