Skip to content

Commit 2c72f36

Browse files
committed
Follow-up to #244: the update check's tests read the version the way the app does, so a build that sets APP_BUILD runs them against its own installed version
1 parent f9ea6f3 commit 2c72f36

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎frontend/src/lib/update.test.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ describe('semver comparison (via checkForUpdate behavior)', () => {
243243

244244
// Versions are derived from the running __APP_VERSION__ so the suite never breaks
245245
// when package.json bumps. bump(2, +1) raises the patch; bump(0, +1) raises the major.
246-
const [MAJ, MIN, PATCH] = __APP_VERSION__.split('.').map(Number)
246+
// Read without its build metadata, the way compareSemver reads it: a build that sets
247+
// APP_BUILD (#244) runs this suite as "1.3.8+<build>", and then it checks the installed side.
248+
const [MAJ, MIN, PATCH] = __APP_VERSION__.split('+')[0].split('.').map(Number)
247249
const bump = (idx, by) => {
248250
const parts = [MAJ, MIN, PATCH]
249251
parts[idx] += by
@@ -268,8 +270,9 @@ describe('semver comparison (via checkForUpdate behavior)', () => {
268270
// A version may say which build it came from, as semver build metadata ("1.3.8+2026-09-18.2").
269271
// It takes no part in precedence, and splitting it on "." used to make the patch NaN — which
270272
// read as 0, so a tag carrying it compared as x.y.0 and a real update went unnoticed. Dropped
271-
// on both operands, so the same holds whichever side carries it; here it is the tag, which is
272-
// the side a test can reach (__APP_VERSION__ is a build-time define).
273+
// on both operands, so the same holds whichever side carries it; here it is the tag. The
274+
// installed side is __APP_VERSION__, a build-time define: run the suite with APP_BUILD set
275+
// and every case in this block reads it with metadata too.
273276
const BUILD = '+2026-09-18.2'
274277
const [MAJOR, MINOR, PATCH_N] = __APP_VERSION__.split('+')[0].split('.').map(Number)
275278
const tagged = (maj, min, patch) => 'v' + [maj, min, patch].join('.') + BUILD

0 commit comments

Comments
 (0)