NEO-142: clear GDScript linter warnings in faction HUD work
Hoist quest progress label lines binding; drop redundant await on synchronous GdUnit assert_signal calls.pull/182/head
parent
be7878a199
commit
f8a36213a1
|
|
@ -364,41 +364,39 @@ func _render_progress_label() -> void:
|
||||||
if not is_instance_valid(_progress_label):
|
if not is_instance_valid(_progress_label):
|
||||||
return
|
return
|
||||||
var header := "Quests:"
|
var header := "Quests:"
|
||||||
|
var lines: PackedStringArray = [header]
|
||||||
if _last_snapshot.is_empty():
|
if _last_snapshot.is_empty():
|
||||||
var lines: PackedStringArray = [header]
|
|
||||||
if not _progress_error.is_empty():
|
if not _progress_error.is_empty():
|
||||||
lines.append("error — %s" % _progress_error)
|
lines.append("error — %s" % _progress_error)
|
||||||
if not _defs_error.is_empty():
|
if not _defs_error.is_empty():
|
||||||
lines.append("definitions error — %s" % _defs_error)
|
lines.append("definitions error — %s" % _defs_error)
|
||||||
lines.append("Loading…")
|
lines.append("Loading…")
|
||||||
_progress_label.text = "\n".join(lines)
|
|
||||||
return
|
|
||||||
var lines: PackedStringArray = [header]
|
|
||||||
if not _progress_error.is_empty():
|
|
||||||
lines.append("sync error — %s" % _progress_error)
|
|
||||||
if not _defs_error.is_empty():
|
|
||||||
lines.append("definitions error — %s" % _defs_error)
|
|
||||||
var defs: Array = _defs_snapshot()
|
|
||||||
if defs.is_empty():
|
|
||||||
var quests: Variant = _last_snapshot.get("quests", null)
|
|
||||||
if quests is Array:
|
|
||||||
for row_variant in quests as Array:
|
|
||||||
if not row_variant is Dictionary:
|
|
||||||
continue
|
|
||||||
var row: Dictionary = row_variant
|
|
||||||
var qid: String = str(row.get("questId", ""))
|
|
||||||
lines.append(" %s" % _format_status_line(qid, qid, row))
|
|
||||||
else:
|
else:
|
||||||
for def_variant in defs:
|
if not _progress_error.is_empty():
|
||||||
if not def_variant is Dictionary:
|
lines.append("sync error — %s" % _progress_error)
|
||||||
continue
|
if not _defs_error.is_empty():
|
||||||
var def: Dictionary = def_variant
|
lines.append("definitions error — %s" % _defs_error)
|
||||||
var qid: String = str(def.get("id", ""))
|
var defs: Array = _defs_snapshot()
|
||||||
if qid.is_empty():
|
if defs.is_empty():
|
||||||
continue
|
var quests: Variant = _last_snapshot.get("quests", null)
|
||||||
var row: Dictionary = _quest_row(qid)
|
if quests is Array:
|
||||||
var label: String = _display_name(qid)
|
for row_variant in quests as Array:
|
||||||
lines.append(" %s" % _format_status_line(qid, label, row))
|
if not row_variant is Dictionary:
|
||||||
|
continue
|
||||||
|
var row: Dictionary = row_variant
|
||||||
|
var qid: String = str(row.get("questId", ""))
|
||||||
|
lines.append(" %s" % _format_status_line(qid, qid, row))
|
||||||
|
else:
|
||||||
|
for def_variant in defs:
|
||||||
|
if not def_variant is Dictionary:
|
||||||
|
continue
|
||||||
|
var def: Dictionary = def_variant
|
||||||
|
var qid: String = str(def.get("id", ""))
|
||||||
|
if qid.is_empty():
|
||||||
|
continue
|
||||||
|
var row: Dictionary = _quest_row(qid)
|
||||||
|
var label: String = _display_name(qid)
|
||||||
|
lines.append(" %s" % _format_status_line(qid, label, row))
|
||||||
_progress_label.text = "\n".join(lines)
|
_progress_label.text = "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ func test_request_sync_emits_faction_standing_received() -> void:
|
||||||
# Act
|
# Act
|
||||||
c.call("request_sync_from_server")
|
c.call("request_sync_from_server")
|
||||||
# Assert
|
# Assert
|
||||||
await assert_signal(c).is_emitted("faction_standing_received", any())
|
assert_signal(c).is_emitted("faction_standing_received", any())
|
||||||
assert_that(_standing_capture.has("factions")).is_true()
|
assert_that(_standing_capture.has("factions")).is_true()
|
||||||
assert_that(transport.last_url).contains("/faction-standing")
|
assert_that(transport.last_url).contains("/faction-standing")
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ func test_http_404_emits_faction_standing_sync_failed() -> void:
|
||||||
# Act
|
# Act
|
||||||
c.call("request_sync_from_server")
|
c.call("request_sync_from_server")
|
||||||
# Assert
|
# Assert
|
||||||
await assert_signal(c).is_emitted(
|
assert_signal(c).is_emitted(
|
||||||
"faction_standing_sync_failed", "HTTP 404 (player unknown)"
|
"faction_standing_sync_failed", "HTTP 404 (player unknown)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ func test_completion_transition_emits_economy_refresh_signal() -> void:
|
||||||
controller.call("_on_progress_received", _active_gather_snapshot())
|
controller.call("_on_progress_received", _active_gather_snapshot())
|
||||||
controller.call("_on_progress_received", _completed_gather_with_summary_snapshot())
|
controller.call("_on_progress_received", _completed_gather_with_summary_snapshot())
|
||||||
# Assert
|
# Assert
|
||||||
await assert_signal(controller).is_emitted("quest_completion_reward_transition", any(), any())
|
assert_signal(controller).is_emitted("quest_completion_reward_transition", any(), any())
|
||||||
|
|
||||||
|
|
||||||
func test_completion_transition_invokes_economy_refresh_callback() -> void:
|
func test_completion_transition_invokes_economy_refresh_callback() -> void:
|
||||||
|
|
@ -360,9 +360,9 @@ func test_boot_completed_does_not_emit_economy_refresh_signal() -> void:
|
||||||
# Act
|
# Act
|
||||||
controller.call("_on_progress_received", _completed_gather_with_summary_snapshot())
|
controller.call("_on_progress_received", _completed_gather_with_summary_snapshot())
|
||||||
# Assert
|
# Assert
|
||||||
await (assert_signal(controller).wait_until(200).is_not_emitted(
|
assert_signal(controller).wait_until(200).is_not_emitted(
|
||||||
"quest_completion_reward_transition"
|
"quest_completion_reward_transition"
|
||||||
))
|
)
|
||||||
|
|
||||||
|
|
||||||
func test_completion_transition_queues_economy_refresh_while_clients_busy() -> void:
|
func test_completion_transition_queues_economy_refresh_while_clients_busy() -> void:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue