Commit dd4e786
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
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
0 commit comments