mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handle some plans having zero cost 🟥
This commit is contained in:
parent
b4583d3c8b
commit
678de56def
1 changed files with 21 additions and 0 deletions
|
|
@ -118,6 +118,27 @@ def test_all_plans_zero_cost__highest_priority_returned(
|
||||||
assert actual_default_plan.id == expected_default_plan_id
|
assert actual_default_plan.id == expected_default_plan_id
|
||||||
|
|
||||||
|
|
||||||
|
def test_some_plans_zero_cost__cheapest_returned(
|
||||||
|
created_at_datetime: datetime,
|
||||||
|
) -> None:
|
||||||
|
# arrange
|
||||||
|
epc_c_plan = make_plan(created_at_datetime, True, cost_of_works=0.0, name="EPC C")
|
||||||
|
minor_works_plan = make_plan(
|
||||||
|
created_at_datetime, False, cost_of_works=50.0, name="EPC C - Minor Works"
|
||||||
|
)
|
||||||
|
scenario_priority_order: List[int] = [4, 3]
|
||||||
|
expected_default_plan_id = 2
|
||||||
|
|
||||||
|
# act
|
||||||
|
actual_default_plan = choose_cheapest_relevant_plan(
|
||||||
|
plans=[epc_c_plan, minor_works_plan],
|
||||||
|
scenario_priority_order=scenario_priority_order,
|
||||||
|
)
|
||||||
|
|
||||||
|
# assert
|
||||||
|
assert actual_default_plan.id == expected_default_plan_id
|
||||||
|
|
||||||
|
|
||||||
def test_all_plans_null_cost__highest_priority_returned(
|
def test_all_plans_null_cost__highest_priority_returned(
|
||||||
created_at_datetime: datetime,
|
created_at_datetime: datetime,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue