| 1 | import assert from "node:assert/strict"; |
| 2 | import { readFile } from "node:fs/promises"; |
| 3 | import { test } from "node:test"; |
| 4 | |
| 5 | const css = await readFile(new URL("../styles/changelog.css", import.meta.url), "utf8"); |
| 6 | const component = await readFile(new URL("../components/ChangelogPage.astro", import.meta.url), "utf8"); |
| 7 | const versionPage = await readFile(new URL("../pages/changelog/[version].astro", import.meta.url), "utf8"); |
| 8 | |
| 9 | test("historical changelog styling remains readable", () => { |
| 10 | assert.doesNotMatch(css, /var\(--(?:muted|paper)\)/); |
| 11 | assert.match(css, /\.release-channel\s*\{/); |
| 12 | }); |
| 13 | |
| 14 | test("changelog has one official navigation and marks archives noindex", () => { |
| 15 | assert.doesNotMatch(component, /release-channel-tabs/); |
| 16 | assert.match(component, /Historical archive/); |
| 17 | assert.match(component, /noindex=\{isPreview\}/); |
| 18 | }); |
| 19 | |
| 20 | test("reviewed exact-version routes redirect safely until their publication marker exists", () => { |
| 21 | assert.match(versionPage, /publishedReleases/); |
| 22 | assert.match(versionPage, /publishedVersions\.has\(release\.version\)/); |
| 23 | assert.match(versionPage, /if \(!published\)/); |
| 24 | assert.match(versionPage, /return Astro\.redirect/); |
| 25 | assert.match(versionPage, /Astro\.redirect\('\/changelog\/'\)/); |
| 26 | }); |
| 27 |