Testing and TDD - AndhikaNayakaAW/DECO2850-team-project GitHub Wiki
Home · Get started · Design · Architecture · Testing · Deployment · Watch & reflection · Weekly contribution
Testing and TDD
The current web suite passes 200 tests across 20 files. The native Garmin suite passes 26 tests in the fenix847mm simulator. The release builder has 9 Node contract and artifact tests, also run in GitHub Actions. Native simulator checks run separately on a Mac with Garmin's SDK and device profile.
Run the checks
cd offshift-phone
npm test
npm run typecheck
npm run build
cd ..
node --test offshift-watch/test/*.test.mjs
node --test prototype/offshift.logic.test.js
For native tests, set the SDK and signing-key paths as documented in offshift-watch/README.md:
node offshift-watch/scripts/build.mjs --test
"$OFFSHIFT_GARMIN_SDK/bin/monkeydo" offshift-watch/bin/offshift-test.prg fenix847mm -t
The simulator must be open. Inspect its final PASSED (passed=26, failed=0, errors=0) summary. On this SDK installation monkeydo returned status 1 even when that complete summary passed; the native result was checked from its output, not inferred from the exit status.
Six observed test-first cycles
| Cycle | Red evidence | Green implementation |
|---|---|---|
| Production endpoint | 6 build contracts fail; one rejection guard passes. | HTTPS validation, normalized calendar URLs, private access-code build and explicit loopback simulation. |
| Round-screen theme | Original 15 native tests pass; 3 new theme assertions fail. | Cream ground, Offshift branding, readable ink, vector type and page indicators; all 18 pass. |
| Reply status and confirmation | 21 native tests pass; 2 fail on stale offline status and an opaque 401. | Clear status after a reply and explain access errors; all 23 pass. Cancellation and failed-send safety also verified. |
| Retained laptop settings | A targeted native regression fails after persisting a laptop URL. | Each build uses its compiled endpoint; all 24 native tests pass. |
| Private build artifacts | Two new tests fail: MIR is published beside the release and compiler failure replaces a working binary. | Compile privately and publish program/symbol files after success; all nine build tests pass. |
| Missing sensor history | 6e81a03: 25 pass; one new assertion errors because a timestamp-only payload is produced. |
9465c22: no health upload without a signal; foreground/background fetch the calendar, and band zero remains valid. All 26 pass. |
Each red test commit precedes its green implementation commit. The current contribution record links every commit. UI copy and glance polish were subsequent refinements, not represented as additional TDD cycles.
Native coverage
Layout checks use Garmin's device fonts and circle geometry to find overlap, clipping and premature truncation for asks, deferred asks, empty/offline states and long names. Theme tests measure text contrast. Sync tests exercise failed replies, successful recovery, cancellation and explicit confirmation without real network requests. Health tests retain the teammate's original mapping and raw-value boundary checks.
The native log is saved as release evidence. The refreshed Ask page was also inspected in the simulator using an isolated practice session.
Production integration checks
Seventeen synthetic checks ran against the deployed HTTPS API with Redis. They verified unauthorized access, the login cookie, shared asks, a pair of concurrent answers resolving only once, one resulting shift, health sharing, the team projection and sharing-off deletion. The synthetic session was cleared afterward. Machine-readable results.
These checks do not prove physical watch installation, real sensor delivery, accessibility on the wrist or worker outcomes. Record those separately when actually observed. Previous browser-reflection and overnight-shift TDD evidence remains in the 15 October contribution report.
Build contract and artifact test output.
Physical test · 20 October
The physical watch completed a verified request/reply round trip and delivered available Garmin bands. The corrected release was transferred and read back exactly; post-transfer connection evidence is tracked independently.