Skip to content

test: fix inverted SparklineData direction semantics for lower-is-better metrics in _make_report_with_sparklines #305

@decko

Description

@decko

Finding

File: tests/test_report_html.py:4395
Severity: Minor

Description

The test helper _make_report_with_sparklines constructs rework_cycles SparklineData with direction='down' and delta=-0.3. However, rework_cycles is a lower-is-better metric, so a decrease (negative delta) represents an improvement and should have direction='up'. The current fixture has inverted semantics — it validates that ▼ (red/declining) appears, when the correct behavior for a rework_cycles decrease should be ▲ (green/improving).

Suggested Fix

  1. Change the rework_cycles fixture to direction='up' (matching what build_sparkline_data would produce for a lower-is-better metric that decreases).
  2. Add a separate fixture with direction='down' for a higher-is-better metric that decreases to test the ▼ rendering path, so both rendering branches (▲ and ▼) remain covered.

Impact

The test currently asserts the wrong rendered output for rework_cycles trend arrows. Any regression that accidentally renders ▲ for a declining higher-is-better metric (or vice-versa) would not be caught.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions