Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

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

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