Skip to content

[#333][test] Add regression tests for workout constant IDs#340

Open
ayazhankadessova wants to merge 1 commit intocyberjunky:masterfrom
ayazhankadessova:issue-333
Open

[#333][test] Add regression tests for workout constant IDs#340
ayazhankadessova wants to merge 1 commit intocyberjunky:masterfrom
ayazhankadessova:issue-333

Conversation

@ayazhankadessova
Copy link

@ayazhankadessova ayazhankadessova commented Mar 24, 2026

Summary

  • Add regression tests pinning workout constant IDs (TargetType, StepType, ConditionType, SportType) to their correct Garmin API values
  • The constants themselves were already fixed in commit 1cedfc2, but no tests existed to prevent future drift
  • 4 test functions covering all 27 constant values

What changed from the previous PR (#335)

Fixed incorrect test assertions for ConditionType and SportType that didn't match the actual values in workout.py.

Test plan

  • pytest tests/test_workout_constants.py — all 4 tests pass locally
  • CI passes

Closes #333

Summary by CodeRabbit

  • Tests
    • Added regression tests for workout configuration enums to verify they match expected values in the Garmin API specification, ensuring API compatibility.

Pin TargetType, StepType, ConditionType, and SportType constant values
to prevent silent drift from Garmin API mappings.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5a6dcac7-2897-4020-b197-90a12368912c

📥 Commits

Reviewing files that changed from the base of the PR and between 418cc3d and 578f98a.

📒 Files selected for processing (1)
  • tests/test_workout_constants.py

Walkthrough

A new regression test module was added to verify that TargetType, StepType, ConditionType, and SportType enum constants map to their correct Garmin API integer IDs through automated assertions.

Changes

Cohort / File(s) Summary
Regression Tests
tests/test_workout_constants.py
Added four test functions asserting that workout enum constants map to exact Garmin API integer IDs: TargetType.NO_TARGET, StepType.WARMUP, ConditionType.DISTANCE, and SportType.RUNNING each validated to their expected values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding regression tests for workout constant IDs to prevent future bugs.
Linked Issues check ✅ Passed The PR adds comprehensive regression tests for all workout constant enums (TargetType, StepType, ConditionType, SportType) that verify correct mapping to expected Garmin API values, directly addressing issue #333's objective to prevent future constant ID drift.
Out of Scope Changes check ✅ Passed The PR contains only regression tests for workout constants, which is directly in scope with issue #333 and the objective to prevent future regressions of the fixed constant mappings.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TargetType.HEART_RATE constant is incorrect (maps to power zone, not heart rate)

1 participant