test(signup): fail when the terms version drifts from the pages #379

Sammanfogat
supernaut sammanfogade 1 incheckning från test/terms-version in i main 2026-10-13 07:24:48 +00:00
Ägare

Closes #323

What

  • TERMS_VERSION moves from src/pages/api/signup.ts to src/lib/terms-version.ts. Value unchanged (2026-10-11).
  • New vitest src/lib/terms-version.test.ts reads the "Last updated" / "Senast uppdaterad" line of src/content/{sv,en}/{terms,privacy}.md.
  • It asserts sv and en agree per page.
  • It asserts the later of the terms and privacy dates equals TERMS_VERSION.

The test fails in both directions. Changing a content date without the constant fails it. Changing the constant without the content fails it.

No version bump here.

Sign-up rows with an older version

The constant already matches the pages, so no new rows are affected. Older rows may hold a version that was replaced before it was fixed. To list them:

select terms_version, count(*) from signups group by 1 order by 1;

Any value other than 2026-10-11 is a row stored under an older text. The operator decides whether to annotate them. No row is changed by this PR.

Checks

pnpm test, pnpm check, pnpm lint, pnpm build pass. Editing the en/terms.md date makes both new tests fail.

Closes #323 ## What - `TERMS_VERSION` moves from `src/pages/api/signup.ts` to `src/lib/terms-version.ts`. Value unchanged (`2026-10-11`). - New vitest `src/lib/terms-version.test.ts` reads the "Last updated" / "Senast uppdaterad" line of `src/content/{sv,en}/{terms,privacy}.md`. - It asserts sv and en agree per page. - It asserts the later of the terms and privacy dates equals `TERMS_VERSION`. The test fails in both directions. Changing a content date without the constant fails it. Changing the constant without the content fails it. No version bump here. ## Sign-up rows with an older version The constant already matches the pages, so no new rows are affected. Older rows may hold a version that was replaced before it was fixed. To list them: ```sql select terms_version, count(*) from signups group by 1 order by 1; ``` Any value other than `2026-10-11` is a row stored under an older text. The operator decides whether to annotate them. No row is changed by this PR. ## Checks `pnpm test`, `pnpm check`, `pnpm lint`, `pnpm build` pass. Editing the `en/terms.md` date makes both new tests fail.
supernaut lade till 1 incheckning 2026-10-13 06:31:27 +00:00
test(signup): fail when TERMS_VERSION drifts from the content dates
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m12s
96dc9c1aa4
Move TERMS_VERSION to src/lib/terms-version.ts so a vitest can import it.
supernaut tvångsskickade test/terms-version från 96dc9c1aa4
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m12s
till 72f1e3d49f
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m5s
2026-10-13 06:38:11 +00:00
Jämför
supernaut sammanfogade incheckning 4282ef1d57 till main 2026-10-13 07:24:48 +00:00
supernaut tog bort grenen test/terms-version 2026-10-13 07:24:48 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web!379
Ingen beskrivning angiven.