Files
TheTree_mock/tests/fixtures/pre_upkeep_runtime.gd

26 lines
1.1 KiB
GDScript

extends RefCounted
## Build a genuine pre-v10 fixture only when no upkeep ledger history exists.
static func strip_empty_upkeep(data: Dictionary) -> void:
preload("res://tests/fixtures/pre_auto_purchase_runtime.gd").strip_empty(data)
for entry: Dictionary in data[&"economy"][&"entries"]:
assert(String(entry.get(&"category", "")) not in ["MAINTENANCE_ACCRUAL", "MAINTENANCE_PAYMENT"])
data.erase(&"weather")
data.erase(&"facility_cleanliness")
data.erase(&"facility_upkeep")
data.erase(&"upkeep_settlement")
var accounts: Array = data[&"economy"][&"accounts"]
for index in range(accounts.size() - 1, -1, -1):
if String(accounts[index][&"account_id"]) in ["MAINTENANCE_EXPENSE", "MAINTENANCE_PAYABLE"]:
accounts.remove_at(index)
static func migrated_accrual(minute: int) -> Dictionary:
var accrual := FacilityUpkeepAccrual.new()
accrual.start_at(minute)
return accrual.create_snapshot()
static func migrated_weather(minute: int) -> Dictionary:
var weather = preload("res://scripts/environment/weather_timeline.gd").new()
weather.initialize(&"clear", minute)
return weather.create_snapshot()