Goals — QA Plan
1. Create
| # | Scenario | Expected |
|---|---|---|
| 1.1 | Lose-weight goal: target < current weight | 201; direction='decrease'; startValue=current |
| 1.2 | Gain-weight goal: target > current | 201; direction='increase' |
| 1.3 | Explicit startValue override | Service uses provided value, not snapshot |
| 1.4 | startValue == targetValue | 400 |
| 1.5 | Increase goal with start > target | 400 |
| 1.6 | body_metric without metricType | 400 |
| 1.7 | exercise_pr without exerciseId | 400 |
| 1.8 | exercise_pr referencing canonical exercise | Allowed |
| 1.9 | exercise_pr referencing another org’s exercise | 404 |
| 1.10 | No prior body_metric → auto-resolve fails | startValueNumeric=null; progress falls back to ratio |
2. Progress computation
Unit-tested in goals.progress.unit.spec.ts. QA spot-checks:
| # | Scenario | Expected |
|---|---|---|
| 2.1 | Increase: start=70, target=80, current=75 | 50% |
| 2.2 | Decrease: start=80, target=72, current=76 | 50% |
| 2.3 | Increase, current ≥ target | 100% capped |
| 2.4 | Decrease, current ≤ target | 100% capped |
| 2.5 | No baseline, current=75, target=80 | 75/80 = 93.75% |
3. Achievement
| # | Scenario | Expected |
|---|---|---|
| 3.1 | Update goal to a target already crossed | Status flips to achieved, achievedAt set |
| 3.2 | Record a new body_metric that crosses target | Next read shows achieved |
| 3.3 | After achievement, target moved higher again | Goes back to active (achievedAt cleared) — verify desired behavior with product |
4. CRUD permissions
| # | Scenario | Expected |
|---|---|---|
| 4.1 | Member updates own goal | 200 |
| 4.2 | Member updates another’s | 403 |
| 4.3 | Coach views member’s goals | 200 |
| 4.4 | Coach from another org views | 403 |
5. Smoke
- Lose-weight goal renders progress correctly after a new body metric.
- Decrease goal does NOT auto-achieve at creation.
- Archive (soft-delete) removes from listings.