Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/frontend/tests
diff options
context:
space:
mode:
authorLeitwolf2026-10-18 02:22:48 +0300
committerGitHub2026-10-18 02:22:48 +0300
commitc2eb3d208b37826167496cfdf657ffca33fef703 (patch)
tree7e459be0fa4ac04c126413e405c3939e26cb86bc /frontend/tests
parent7190d8a0911b4cea07cc502a1e471f0889b6d20b (diff)
parent43c431a793affe2fa41ead816268d6af760f72d0 (diff)
downloadwebsite-c2eb3d208b37826167496cfdf657ffca33fef703.tar.gz
Merge pull request #40 from Progmasoft/design/landing-pages
Give each site a calm landing page with a "Why" section
Diffstat (limited to 'frontend/tests')
-rw-r--r--frontend/tests/site-integrity.test.mjs35
-rw-r--r--frontend/tests/sites.test.mjs7
2 files changed, 21 insertions, 21 deletions
diff --git a/frontend/tests/site-integrity.test.mjs b/frontend/tests/site-integrity.test.mjs
index 922c03d..51a422b 100644
--- a/frontend/tests/site-integrity.test.mjs
+++ b/frontend/tests/site-integrity.test.mjs
@@ -26,10 +26,12 @@ test("every site publishes exactly its own pages in its sitemap", () => {
"https://tala.run/docs/syntax",
]);
assert.deepEqual(locations("public/hosts/talac/sitemap.xml"), [
+ "https://talac.tala.run/",
"https://talac.tala.run/docs/command-line",
"https://talac.tala.run/docs/outputs",
]);
assert.deepEqual(locations("public/hosts/tazel/sitemap.xml"), [
+ "https://tazel.tala.run/",
"https://tazel.tala.run/docs/commands",
"https://tazel.tala.run/docs/project-file",
]);
@@ -93,7 +95,8 @@ test("the social image is a 1280 by 640 PNG suitable for the page metadata", ()
test("the site has no retired public login or registry links", () => {
const sources = [
"src/App.vue",
- "src/pages/HomePage.vue",
+ "src/pages/LandingPage.vue",
+ "src/content/landing.ts",
"src/pages/OverviewPage.vue",
"src/pages/GettingStartedPage.vue",
];
@@ -122,26 +125,22 @@ test("every linked repository path used by the guides exists when compiler sourc
}
});
-test("the site example is copied from the compiler repository when available", (context) => {
+test("the site examples are copied from the compiler repository when available", async (context) => {
const compilerRoot = join(websiteRoot, "..");
- const examplePath = join(compilerRoot, "Examples/HelloWorld/HelloWorld.tala");
- if (!existsSync(examplePath)) {
+ if (!existsSync(join(compilerRoot, "Examples/HelloWorld/HelloWorld.tala"))) {
context.skip("standalone website checkout has no sibling compiler repository");
return;
}
- const source = readFileSync(examplePath, "utf8");
- const program = source
- .slice(source.indexOf("namespace Examples.HelloWorld;"))
- .replaceAll("\r\n", "\n")
- .trim();
- const pages = ["src/pages/HomePage.vue", "src/pages/GettingStartedPage.vue"];
- for (const page of pages) {
- const content = read(page);
- assert.ok(
- content.replaceAll("\r\n", "\n").includes(program),
- `${page} diverged from the compiler example`,
- );
- }
+ const program = (name) => {
+ const source = readFileSync(join(compilerRoot, `Examples/${name}/${name}.tala`), "utf8");
+ return source.slice(source.indexOf("namespace ")).replaceAll("\r\n", "\n").trim();
+ };
+ const samples = await import("../src/content/landing.ts");
+ assert.equal(samples.helloWorld, program("HelloWorld"), "the HelloWorld tab diverged");
+ assert.equal(samples.primeNumbers, program("PrimeNumbers"), "the PrimeNumbers tab diverged");
+ assert.equal(samples.gcd, program("GCD"), "the GCD sample diverged");
+ const guide = read("src/pages/GettingStartedPage.vue").replaceAll("\r\n", "\n");
+ assert.ok(guide.includes(program("HelloWorld")), "the guide diverged from the compiler example");
});
test("maintenance mode preserves the legacy redirect without opening the language site", () => {
@@ -267,7 +266,7 @@ test("navigation, router, and sitemap agree on the public language pages", () =>
test("every public link in the page shell uses the correct project identity", () => {
const shell = read("src/App.vue");
- const home = read("src/pages/HomePage.vue");
+ const home = read("src/content/landing.ts");
const overview = read("src/pages/OverviewPage.vue");
const guide = read("src/pages/GettingStartedPage.vue");
const combined = [shell, home, overview, guide].join("\n");
diff --git a/frontend/tests/sites.test.mjs b/frontend/tests/sites.test.mjs
index 6999d55..d417dbc 100644
--- a/frontend/tests/sites.test.mjs
+++ b/frontend/tests/sites.test.mjs
@@ -67,8 +67,8 @@ test("every topic a sidebar lists is a page of its site", () => {
assert.ok(sidebar.every((entry) => entry.label.length > 0 && !entry.label.startsWith("/")));
}
}
- assert.equal(siteHome.talac, siteTopics.talac[0]);
- assert.equal(siteHome.tazel, siteTopics.tazel[0]);
+ // Every site opens on its own landing page rather than on a documentation topic.
+ assert.deepEqual(siteHome, { language: "/", talac: "/", tazel: "/" });
});
test("every topic is written in every language with the same code in each", () => {
@@ -134,7 +134,8 @@ test("each site names its pages and points canonical URLs at its own host", () =
assert.equal(talac.title, "Ausgaben · Talac");
assert.equal(talac.canonicalPath, "/docs/outputs");
const tazel = pageMetadata("/", "en-US", "tazel");
- assert.equal(tazel.canonicalPath, "/docs/commands");
+ assert.equal(tazel.canonicalPath, "/");
+ assert.equal(tazel.title, "Tazel — The build system of Tala");
assert.equal(pageMetadata("/docs/syntax", "ru-RU", "language").title, "Синтаксис · Tala");
assert.equal(pageMetadata("/docs/outputs", "en-US", "language").canonicalPath, "/");
assert.deepEqual(siteHosts, {