Release Time Tools 0.1.0

This commit is contained in:
2026-09-01 02:54:04 +02:00
commit 3c82e7a305
61 changed files with 8965 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
import { expect, test, type Page } from "@playwright/test";
const ORIGIN = "http://127.0.0.1:4173";
async function localOnly(page: Page) {
const external: string[] = [];
await page.route("**/*", async (route) => {
const url = new URL(route.request().url());
if (url.origin !== ORIGIN) {
external.push(url.href);
await route.abort();
} else await route.continue();
});
return external;
}
test("runs from a nested path without external requests", async ({ page }) => {
const errors: string[] = [];
page.on("pageerror", (error) => errors.push(error.message));
page.on("console", (message) => {
if (message.type() === "error") errors.push(message.text());
});
const external = await localOnly(page);
await page.goto("/deep/nested/time/");
await expect(page.getByRole("heading", { name: "Time Tools" })).toBeVisible();
expect(external).toEqual([]);
expect(errors).toEqual([]);
});
test("converts a negative nanosecond epoch exactly", async ({ page }) => {
const external = await localOnly(page);
await page.goto("/deep/nested/time/");
await page.getByLabel("Epoch value").fill("-0.000000001");
await page.getByRole("button", { name: "Convert exactly" }).click();
await expect(
page.getByRole("heading", { name: "Exact timestamp conversion" }),
).toBeVisible();
await expect(page.locator(".result > pre")).toContainText(
"1969-12-31T23:59:59.999999999Z",
);
await expect(page.locator(".result > pre")).toContainText(
'"epochNanoseconds": "-1"',
);
expect(external).toEqual([]);
});
test("serves the release identity and hardened headers", async ({
request,
}) => {
const index = await request.get("/deep/nested/time/");
expect(index.ok()).toBe(true);
expect(index.headers()["content-security-policy"]).toContain(
"default-src 'self'",
);
expect(await index.text()).not.toMatch(/\b(?:src|href)=["']\//u);
const manifest = await request.get("/deep/nested/time/toolbox-app.json");
await expect(manifest.json()).resolves.toMatchObject({
id: "de.add-ideas.time-tools",
version: "0.1.0",
entry: "./",
});
});