1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Fix typo in energy calculation (#25259)

* New energy calculation

* more tests and stricter tests. change priority order

* more test and fix error
This commit is contained in:
karwosts
2025-04-30 21:27:11 -07:00
committed by GitHub
parent 1c12aea8f6
commit cd3e4f55e2
2 changed files with 24 additions and 1 deletions

View File

@@ -462,6 +462,8 @@ describe("Energy Usage Calculation Tests", () => {
used_total: 9,
}
);
});
it("Solar -> Battery -> Grid", () => {
assert.deepEqual(
checkConsumptionResult({
from_grid: 0,
@@ -482,4 +484,25 @@ describe("Energy Usage Calculation Tests", () => {
}
);
});
it("Solar -> Grid && Grid -> Battery", () => {
assert.deepEqual(
checkConsumptionResult({
from_grid: 1,
to_grid: 1,
solar: 1,
to_battery: 1,
from_battery: 0,
}),
{
grid_to_battery: 1,
battery_to_grid: 0,
used_solar: 0,
used_grid: 0,
used_battery: 0,
solar_to_battery: 0,
solar_to_grid: 1,
used_total: 0,
}
);
});
});