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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Tests: the prefetch check passes a missing navigator as null (Node 22 has a global one), and the sign-out purge is waited for, not slept on
Duarte Santos3ed6e1cad4f5
diff --git a/frontend/src/lib/media-prefetch.test.js b/frontend/src/lib/media-prefetch.test.jsindex 19deaba62..8da1340bb 100644--- a/frontend/src/lib/media-prefetch.test.js+++ b/frontend/src/lib/media-prefetch.test.js@@ -54,7 +54,8 @@ describe('prefetchAllowed', () => {expect(prefetchAllowed({ onLine: true, connection: { type: 'cellular', effectiveType: '4g' } })).toBe(false)expect(prefetchAllowed({ onLine: true, connection: { effectiveType: '2g' } })).toBe(false)expect(prefetchAllowed({ onLine: true, connection: { effectiveType: 'slow-2g' } })).toBe(false)- expect(prefetchAllowed(undefined)).toBe(false)+ // null, not undefined: undefined takes the default, and Node 22 has a global navigator of its own.+ expect(prefetchAllowed(null)).toBe(false)})})diff --git a/frontend/src/store/useStore.media.test.jsx b/frontend/src/store/useStore.media.test.jsxindex bbcef054b..338d15420 100644--- a/frontend/src/store/useStore.media.test.jsx+++ b/frontend/src/store/useStore.media.test.jsx@@ -79,10 +79,11 @@ describe('owed photos and videos', () => {const stash = JSON.parse(localStorage.getItem('gym_stash'))expect(Object.values(stash)[0].state.customEx[0].media.hash).toBe(A)expect(await useStore.getState().stashedMediaHashes()).toEqual(new Set([A, P]))- await new Promise(r => setTimeout(r, 20)) // the purge runs after the wiped copy is written+ // The purge runs after the wiped copy is written; waited for, not slept on, so a slow CI+ // runner cannot look before it has happened.+ await vi.waitFor(async () => expect(await media.has('c'.repeat(64))).toBe(false), { timeout: 3000 })expect(await media.has(A)).toBe(true)expect(await media.has(P)).toBe(true)- expect(await media.has('c'.repeat(64))).toBe(false)})it('a sign-out takes the account\'s files even when its copy no longer refers to any (a photo removed a moment ago)', async () => {@@ -92,8 +93,7 @@ describe('owed photos and videos', () => {localStorage.setItem('gym_sync', JSON.stringify({ rev: 1, ts: 100 }))api.mockImplementation(async (path, o) => (o?.method === 'PUT' ? { ok: true, rev: 2 } : { ok: true }))expect(await useStore.getState().signOut()).toEqual({ owed: false })- await new Promise(r => setTimeout(r, 20)) // the purge runs after the wiped copy is written- expect(await media.has(A)).toBe(false)+ await vi.waitFor(async () => expect(await media.has(A)).toBe(false), { timeout: 3000 }) // the purge runs after the wiped copy is written})it('a different account signing in keeps the previous one\'s waiting photo aside, even with no workouts', async () => {