Files
Goldebek/e2e/fixture-server.mjs
Per Hoener 0d45331f5c
Deploy / validate-dispatch (push) Successful in 43s
Deploy / scheduled-rebuild-dev (push) Skipped
Deploy / scheduled-rebuild-master (push) Skipped
Deploy / rollback-dev (push) Skipped
Deploy / rollback-master (push) Skipped
Deploy / changes (push) Successful in 13s
Deploy / secret-scan (push) Successful in 9s
Deploy / app-quality (push) Successful in 11m21s
Deploy / security-deps (push) Successful in 14s
Deploy / context (push) Failing after 1s
Deploy / app-image (push) Skipped
Deploy / deploy-dev (push) Skipped
Deploy / deploy-master (push) Skipped
Initial commit
2026-09-18 23:37:19 +02:00

36 lines
973 B
JavaScript

import http from "node:http";
const port = Number(process.env.FIXTURE_PORT ?? 3101);
const start = new Date(Date.now() + 7 * 24 * 60 * 60 * 1_000);
const end = new Date(start.getTime() + 2 * 60 * 60 * 1_000);
function icsDate(date) {
return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
}
const calendar = `BEGIN:VCALENDAR\r
VERSION:2.0\r
PRODID:-//Website Starter E2E//DE\r
BEGIN:VEVENT\r
UID:e2e-special-event\r
SUMMARY:E2E Beispieltermin\r
LOCATION:Beispielort\r
DTSTART:${icsDate(start)}\r
DTEND:${icsDate(end)}\r
END:VEVENT\r
END:VCALENDAR\r
`;
const server = http.createServer((_request, response) => {
response.writeHead(200, { "content-type": "text/calendar; charset=utf-8" });
response.end(calendar);
});
server.listen(port, "127.0.0.1", () => {
console.log(`ICS fixture listening on http://127.0.0.1:${port}`);
});
for (const signal of ["SIGINT", "SIGTERM"]) {
process.on(signal, () => server.close(() => process.exit(0)));
}