Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions actions/setup/js/ephemerals.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("ephemerals", () => {
describe("extractExpirationDate", () => {
it("should extract date from body with expiration marker", async () => {
const { extractExpirationDate } = await import("./ephemerals.cjs");
const body = "Some text\n- [x] expires <!-- gh-aw-expires: 2026-01-25T15:54:08.894Z --> on Jan 25, 2026\nMore text";
const body = "Some text\n> - [x] expires <!-- gh-aw-expires: 2026-01-25T15:54:08.894Z --> on Jan 25, 2026\nMore text";
const result = extractExpirationDate(body);

expect(result).toBeInstanceOf(Date);
Expand Down Expand Up @@ -94,23 +94,23 @@ describe("ephemerals", () => {

it("should return null for invalid date", async () => {
const { extractExpirationDate } = await import("./ephemerals.cjs");
const body = "- [x] expires <!-- gh-aw-expires: invalid-date --> on Jan 25, 2026";
const body = "> - [x] expires <!-- gh-aw-expires: invalid-date --> on Jan 25, 2026";
const result = extractExpirationDate(body);

expect(result).toBeNull();
});

it("should return null for invalid legacy date", async () => {
const { extractExpirationDate } = await import("./ephemerals.cjs");
const body = "> - [x] expires on Invalid Date, 9999 UTC";
const body = "> - [x] expires on Not a valid date string UTC";
const result = extractExpirationDate(body);

expect(result).toBeNull();
});

it("should handle standard expiration marker format", async () => {
const { extractExpirationDate } = await import("./ephemerals.cjs");
const body = "Some text\n- [x] expires <!-- gh-aw-expires: 2026-01-25T15:54:08.894Z --> on Jan 25, 2026\nMore text";
const body = "Some text\n> - [x] expires <!-- gh-aw-expires: 2026-01-25T15:54:08.894Z --> on Jan 25, 2026\nMore text";
const result = extractExpirationDate(body);

expect(result).toBeInstanceOf(Date);
Expand Down Expand Up @@ -288,7 +288,7 @@ describe("ephemerals", () => {
expect(EXPIRATION_PATTERN).toBeInstanceOf(RegExp);
});

it("should match standard expiration line without blockquote", async () => {
it("should NOT match standard expiration line without blockquote", async () => {
const { EXPIRATION_PATTERN } = await import("./ephemerals.cjs");
const line = "- [x] expires <!-- gh-aw-expires: 2026-01-25T15:54:08.894Z --> on Jan 25, 2026";
// This should NOT match because the pattern requires blockquote prefix
Expand Down