Skip to content

test(site): check each page's metadata and the translator - #278

Merged
juancguerrerodev merged 5 commits into
DojoCodingLabs:mainfrom
mir-ashiq:test/site-page-metadata
Dec 6, 2026
Merged

juancguerrerodev merged 5 commits into
DojoCodingLabs:mainfrom
mir-ashiq:test/site-page-metadata

Conversation

@mir-ashiq

Copy link
Copy Markdown
Contributor

What and why

Closes #267

Adds apps/site/test/meta.test.ts (Vitest, like the other files in apps/site/test): unit tests for pageMetadata and chooserMetadata in apps/site/lib/meta.ts, for the OG_IMAGE link preview, and for the translator/isLang helpers in apps/site/lib/i18n.ts. Tests only: apps/site/lib and the locale files are unchanged, and the metadata is checked against translator output rather than hard-coded copy, so a copy change doesn't break the tests.

What the tests cover:

  • For each language in LANGS and each page (HM-SITE-01 with "", HM-SITE-02 with "privacy/", HM-SITE-03 with "download/"): title and description from translator(lang), the canonical address href(lang, page), the es-419/en alternates pointing at the same page plus x-default at /, the Open Graph locale (en_US/es_LA) with the other language as the alternate locale, one preview image with OG_IMAGE's address, width and height and the common.ogAlt text, the same image in Open Graph and in the Twitter card, and metadataBase on SITE_URL.
  • chooserMetadata: the canonical address /, the same alternates as the home page, and Spanish as the Open Graph locale.
  • OG_IMAGE.url is /brand/ followed by one of the files in BRAND_FILES.
  • translator: a missing key throws with the key and the language in the message; a placeholder with no value throws with the placeholder named; isLang accepts only "es" and "en", not "es-419" or "EN".

Vision fit

A site that says what is true today, with contributor tools that work: the metadata behind every page's title, canonical address, language alternates and link preview is now checked in seconds by a unit test, without a build and without reading the exported HTML by hand.

Non-negotiables

  • This keeps every non-negotiable in AGENTS.md as it is.
  • Or it changes one, and this is the accepted RFC: n/a

Checklist

  • It closes one issue, linked above, or it's a small fix (a typo, a broken link, a wrong comment). A feature has an accepted proposal.
  • I wrote the failing test first. It fails without this change and passes with it.
  • These pass: pnpm check:privacy, pnpm typecheck, pnpm lint, pnpm test and node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt.
  • No new network call, telemetry, analytics, ads or crash reporting. (A new request in an app adapter is explained below, with host, skill and risk.)
  • No new dependency, or the reason for each one is below.
  • Every UI string is in packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.
  • Tests, fixtures and screenshots use made-up data only.

On the gates: this is a test-only change to apps/site, and I could not run the whole workspace's gates on this machine (the disk is nearly full, so a full pnpm install of every workspace package was not possible; the install was filtered to the root workspace and @hermit/site). What I did run, exactly:

  • pnpm install --filter . --filter @hermit/site (filtered workspace install; lockfile untouched)
  • pnpm --filter @hermit/site test — 11 files, 84 tests, all passing, including the new test/meta.test.ts (11 tests)
  • pnpm --filter @hermit/site test test/meta.test.ts — the new file alone, passing
  • pnpm --filter @hermit/site typecheck — clean
  • pnpm exec eslint apps/site/test/meta.test.ts — clean
  • node scripts/check-privacy.mjs — "privacy: no analytics, crash reporting or login brokers found"
  • node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt — "guard: ok"

Each expectation was broken on purpose to watch it fail before being put back: swapping the Open Graph locale expectation failed all six page tests; a wrong canonical for the chooser, a brand file not in BRAND_FILES, wrong error-message patterns for translator, and isLang("EN") expected true each failed exactly their own test. What I did not run: the full-workspace pnpm typecheck, pnpm lint and pnpm test for the other packages, which this change doesn't touch (it adds one file under apps/site/test and edits nothing else).

Model path

  • This doesn't touch the model path: packages/model, agent, skills or eval, the prompt, the router, tool descriptions, normalizers, examples or the model file.
  • It does. The eval numbers from before and after are below, run as docs/evals.md says. No held-out case was tuned on.

Screenshots

  • No UI change.
  • UI change. Each changed screen is below, in both themes and both languages, with made-up data.
Light Deep sea
es-419 n/a n/a
en n/a n/a

New dependencies and network calls

n/a

AI agents

  • No AI agent wrote any part of this.
  • An AI agent helped. Which one, and what it did: Claude (Anthropic) wrote the test file after reading the issue, AGENTS.md, lib/meta.ts, lib/i18n.ts and the neighbouring tests, ran it, broke each expectation to watch it fail, and put it back. The claim comment on the issue was posted from the mir-ashiq account this branch is pushed from.
  • I read and ran everything in this pull request, and I can explain it.

Copilot AI balanced review requested due to automatic review settings December 6, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@juancguerrerodev

Copy link
Copy Markdown
Contributor

Thanks! A small ask for the next ones: the issues say to take one at a time, so newcomers joining this week find some left. 🦀

@juancguerrerodev
juancguerrerodev merged commit c5dccaa into DojoCodingLabs:main Dec 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Site: test the page metadata and the translator

6 participants