fix: make computeTrend time-independent via injectable now (#7)
Merged
FO
2mo ago+16+16+01234567890123456789-10-10-01234567890123456789
fixes issue #7 — computeTrend gained an optional now param; trend tests now pass a fixed now so they are deterministic (full suite 146/146 green). Closes #7.
Summary by cubic
Makes computeTrend deterministic by accepting an optional now parameter instead of calling new Date() internally, so trend calculations no longer depend on wall-clock time.
Bug Fixes
computeTrendnow takes an optionalnowargument; callers who don't pass it keep the previous behavior.- Trend tests pass a fixed reference date, making the full suite deterministic and green (146/146).
Summary by CodeRabbit
-
Bug Fixes
- Trend calculations now use a consistent reference time, improving result stability across repeated evaluations.
-
Tests
- Trend behavior is now validated against a fixed reference date, making test outcomes more consistent and reliable.