Files
step3/tests/ccs_hub_test.gd
2026-07-19 21:29:24 -05:00

27 lines
1.2 KiB
GDScript

extends SceneTree
var failures := 0
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
var hub = load("res://scripts/ui/ccs_hub.gd")
_assert(hub.has_active_case({"state": "active"}), "active CCS attempts should be resumable")
_assert(hub.has_active_case({"state": "final_orders"}), "final-orders CCS attempts should be resumable")
_assert(not hub.has_active_case({"state": "completed"}), "completed CCS attempts should not appear active")
_assert(not hub.has_active_case({"state": "abandoned"}), "abandoned CCS attempts should not appear active")
_assert(hub.remaining_time_text({"state": "active", "deadlineUtc": "2026-07-19T12:15:00Z"}, 1784462400.0) == "15 min remaining", "active case countdown should use the case deadline")
_assert(hub.humanize("emergency_department") == "Emergency Department", "CCS locations should be human readable")
_assert(hub.format_datetime_parts({"year": 2026, "month": 7, "day": 19, "hour": 13, "minute": 5}) == "Jul 19, 2026\n1:05 PM", "history dates should use the compact local format")
quit(1 if failures > 0 else 0)
func _assert(condition: bool, message: String) -> void:
if condition:
return
failures += 1
push_error(message)