diff options
| author | Leitwolf11 | 2026-11-17 13:22:15 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-17 13:22:15 +0300 |
| commit | e45ac306efd73ec6a5ed37a813455da506d6aab2 (patch) | |
| tree | b64f20e0d8152553f63a235e20fd247e7e28fe5b /apps/web/tests | |
| parent | 477625cd75db2295d0f05bce206d9ea1b5b13ef2 (diff) | |
| download | progmaweb-site/structured-data.tar.gz | |
Add llms.txt and schema.org data, and bring project facts up to datesite/structured-data
Search tools and language models describe Progmasoft from what they can
read; the site now states it plainly.
- progmasoft.com/llms.txt (llmstxt.org form, text/markdown): what
Progmasoft makes, each project with its tagline, description, language,
release or development status, license, source and site, and the
services. It is written from the product catalog, so it follows it. It
says that only the listed projects are developed and that archived
repositories and deprecated packages are not. Only progmasoft.com and
www serve it; the proxy leaves the path alone, as it does robots.txt.
- JSON-LD (components/JsonLd.tsx, with the page's nonce): Organization
and WebSite on progmasoft.com, an ItemList of the projects on the
catalog, and SoftwareSourceCode on each project page (repository,
issues, language, SPDX license URLs, creation date, status, latest
version, site, in the language of the page). `<` is escaped so no
value can close the script element.
- products.ts: Tazel, Archer and Etincelle are MIT and Catch3 is
BSL-1.0 AND LGPL-3.0-or-later; the catalog still showed the licence
with the exception that no project uses any more.
- The Catch3 entry of the catalog, in every language, no longer calls its
runner and mocks planned: both are released; the description lists
the runner, property tests, mocks, snapshots and structured results.
Tests: 49 unit tests (new: SPDX URLs, the data of every project in every
language, the catalog list, escaping, llms.txt content), tsc, eslint,
build, 140 layout tests. Checked on next start: llms.txt 200 on
progmasoft.com and 404 on the other hosts; the JSON-LD of the Catch3 page
parses.
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'apps/web/tests')
| -rw-r--r-- | apps/web/tests/structured-data.test.mjs | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/apps/web/tests/structured-data.test.mjs b/apps/web/tests/structured-data.test.mjs new file mode 100644 index 0000000..a751742 --- /dev/null +++ b/apps/web/tests/structured-data.test.mjs @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import assert from "node:assert/strict"; +import test from "node:test"; +import { llmsText } from "../lib/llms.ts"; +import { supportedLocales } from "../lib/localization.ts"; +import { productSlugs, products } from "../lib/products.ts"; +import { + catalogData, + jsonLd, + licenseUrls, + organizationData, + productData, + websiteData, +} from "../lib/structured-data.ts"; + +const locales = supportedLocales; + +test("an SPDX expression gives one URL per license it names", () => { + assert.deepEqual(licenseUrls("MIT"), ["https://spdx.org/licenses/MIT.html"]); + assert.deepEqual(licenseUrls("BSL-1.0 AND LGPL-3.0-or-later"), [ + "https://spdx.org/licenses/BSL-1.0.html", + "https://spdx.org/licenses/LGPL-3.0-or-later.html", + ]); + assert.deepEqual(licenseUrls("(MIT OR Apache-2.0)"), [ + "https://spdx.org/licenses/MIT.html", + "https://spdx.org/licenses/Apache-2.0.html", + ]); + assert.deepEqual(licenseUrls("GPL-2.0-only WITH Classpath-exception-2.0"), [ + "https://spdx.org/licenses/GPL-2.0-only.html", + ]); +}); + +test("every project has its data in every language", () => { + for (const slug of productSlugs) { + for (const locale of locales) { + const data = productData(slug, locale); + assert.equal(data["@type"], "SoftwareSourceCode"); + assert.equal(data.name, products[slug].name); + assert.equal(data.codeRepository, products[slug].source); + assert.equal(data.inLanguage, locale); + assert.ok(data.description.length > 20, `${slug} ${locale}`); + assert.ok(data.license, `${slug} has a license`); + assert.equal(data.version, products[slug].latestRelease?.version); + } + } +}); + +test("a released project names its version, one in development does not", () => { + assert.equal(productData("catch3", "en-US").creativeWorkStatus, "Released"); + assert.equal( + productData("tazel", "en-US").creativeWorkStatus, + "In development", + ); + assert.equal(productData("tazel", "en-US").version, undefined); +}); + +test("the catalog lists every project in order", () => { + const data = catalogData("en-US"); + assert.equal(data.numberOfItems, productSlugs.length); + assert.deepEqual( + data.itemListElement.map((item) => item.position), + productSlugs.map((_, index) => index + 1), + ); +}); + +test("the organization and the site point at each other", () => { + assert.equal( + websiteData("en-US").publisher["@id"], + organizationData()["@id"], + ); + assert.equal(organizationData()["@type"], "Organization"); +}); + +test("JSON-LD text cannot close its script element", () => { + const text = jsonLd({ name: "</script><script>alert(1)</script>" }); + assert.ok(!text.includes("</script>")); + assert.deepEqual(JSON.parse(text), { + name: "</script><script>alert(1)</script>", + }); +}); + +test("llms.txt lists every project with its facts and names no former project", () => { + const text = llmsText(); + assert.match(text, /^# Progmasoft\n\n> /); + for (const slug of productSlugs) { + assert.ok(text.includes(`(https://product.progmasoft.com/${slug})`), slug); + assert.ok(text.includes(products[slug].license), `${slug} license`); + } + assert.ok(text.includes("latest release 0.4.0")); + for (const word of ["Tala", "Xide", "Talac", "X#"]) { + assert.ok(!text.includes(word), word); + } +}); |