screen-locker/stronglift_replacement/workout_app/lib
Krzysztof kuhy Rudnicki 3de2928967 Fix workout_app widget tests hanging on sqflite-ffi DB ops
Pre-existing: any DB call (saveSession/getExerciseState/setExerciseWeight) made
directly in a testWidgets body runs in the fake-async zone and hangs sqflite-ffi
for ~3-4 min, then crashes the isolate ("Cannot close sink while adding stream"),
aborting the whole file. This blocked the pre-push flutter gate for any Dart-
touching commit. Two fixes:

- Wrap every in-body DB call in tester.runAsync(() => ...) so it runs on the real
  event loop (setUp already does; the passing tests did their reads inside the
  pump helper's runAsync). history/home/settings screen tests.
- StorageService._open: open the test ':memory:' DB with singleInstance:false so
  each test gets a fresh empty DB. sqflite's default singleInstance returned the
  same cached in-memory DB and resetForTesting never closed it, so rows piled up
  across tests and pushed the asserted widget off-screen ("Found 0 widgets").
  Production keeps the default single shared instance.

188 workout_app tests now pass (was aborting after ~4 min). Unrelated to the
manual-workout feature; needed to unblock its Dart commits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PM3auNTifaVgcXWDizZrjH
2026-07-13 12:42:42 +02:00
..
models Manual-workout phone sync P1: wire format + shared constants + fixture 2026-07-13 10:52:00 +02:00
screens Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
services Fix workout_app widget tests hanging on sqflite-ffi DB ops 2026-07-13 12:42:42 +02:00
widgets Add comprehensive test suite, backup service, and linting to workout app 2026-06-28 08:11:43 +02:00
main.dart Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00