Skip to content

Commit dd4e786

Browse files
GuanzhouSongclaude
andauthored
Add a test baseline, starting with the package install commands (#99)
The repository has had no test framework and no test script, so nothing verified any behaviour below the level of "the site builds". This adds Vitest, an `npm test` script, and a CI step that runs it. The first target is app/lib/packageInstall.ts. It is 82 lines of pure string building with no I/O, and it generates the apt and dnf commands published on /packages for users to copy and paste. A wrong codename or architecture there is a broken install instruction on a public site, which makes it both the highest-value and the cheapest thing to cover. The tests run the full distro x architecture x PostgreSQL version matrix and check the parts that are easy to get wrong when a target is added: - the PGDG suite for each Debian and Ubuntu release - the architecture pinned in the DocumentDB apt source line - the repository component and rpm baseurl per target - the EL major version and CodeReady repository name for RHEL - the exact package name installed at the end of each command - that no command contains "undefined", which is what a target added to one map but not another would produce The expected suite and EL-major maps are duplicated in the test rather than imported, because the implementation's copies are module-private and because a change to them should have to be made deliberately in two places. Two things worth noting for anyone extending these tests. The commands legitimately redirect to /dev/null, so the "no placeholder" assertion matches "undefined" and "NaN" but deliberately not "null". And aptTargetPgVersions is asserted to exclude PostgreSQL 18 on Debian 11, matching the documented PGDG bullseye limitation. The lockfile was generated on a GitHub runner rather than locally, because this machine sits behind a corporate registry proxy that cannot reach registry.npmjs.org. Claude-Session: https://claude.ai/code/session_01WWCBtvyCpxc2aqtyLDhDeE Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent e24932f commit dd4e786

4 files changed

Lines changed: 1274 additions & 6 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878
# `next build` does not lint, so without this an ESLint or TypeScript
7979
# upgrade can land without its effect on the lint rules ever running.
8080
run: npm run lint
81+
- name: Test
82+
run: npm test
8183
- name: Build Next.js site
8284
# Validate that the site builds successfully
8385
#

0 commit comments

Comments
 (0)