powersync-energy-plugin-etm/tests
Patrick Schurig 69246618ee fix: test forecast uses UTC hour for solar/price lookup
buildWinterForecast was indexing solarW[] and winterPrices[] by slot
position h instead of actual UTC hour. When a forecast starts at 18:00,
h=8 (02:00 AM) was getting solarW[8]=1200W, giving midnight slots a
false solar bonus in RuleBasedStrategy::slotScore(). The strategy
correctly chose those slots, but countSlotsInCheapestN (price-only)
reported them as outside the 6 cheapest hours → test 1 failed.

Fix: index both arrays by slot.start.toUTC().time().hour() so solar
peaks at noon and prices reflect the real time-of-day. All 11 tests pass.

Also includes the INCLUDEPATH += \$\$PWD fix in energyplugin.pri that
makes relative includes work for test builds consuming the .pri.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 06:53:20 +01:00
..
auto fix: test forecast uses UTC hour for solar/price lookup 2026-02-24 06:53:20 +01:00
mocks initial commit 2026-01-11 11:09:23 +01:00
tests.pro initial commit 2026-01-11 11:09:23 +01:00