Files
code_of_conquest_dnd/client/tests/unit/test_shell_state.gd
Phillip Tarrant 6c496d3ed8 feat(currency): the command-bar purse reads in denominations
The seed placeholder was a flat 1240 gold — 12.4 million copper under the real
model, which is 1,240 plot points in the command bar. It reseeds to 347c, a
party carrying silver and no gold: '◈ 3s 47c'.

This is the only call site of Currency.format() — the display edge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYa9u7Kdxv5gX4AnwWexy8
2026-07-12 18:39:25 -05:00

51 lines
1.4 KiB
GDScript

extends "res://addons/gut/test.gd"
func test_turn_entry_holds_fields():
var e := TurnEntry.new("DW", 12, &"ally")
assert_eq(e.initials, "DW")
assert_eq(e.initiative, 12)
assert_eq(e.side, &"ally")
assert_false(e.is_active)
assert_false(e.is_downed)
func test_seed_vitals():
var s := ShellState.seed()
assert_eq(s.vitals["hp"], 42)
assert_eq(s.vitals["hp_max"], 60)
assert_eq(s.vitals["mp"], 18)
assert_eq(s.vitals["mp_max"], 30)
assert_eq(s.vitals["purse_copper"], 347)
assert_false("gold" in s.vitals, "the flat gold placeholder is gone")
func test_seed_purse_renders_as_denominations():
var s := ShellState.seed()
assert_eq(Currency.format(s.vitals["purse_copper"]), "3s 47c")
func test_seed_turn_order():
var s := ShellState.seed()
assert_eq(s.turn_order.size(), 4)
assert_eq(s.turn_order[0].initials, "EL")
assert_true(s.turn_order[0].is_active, "first combatant is the active turn")
assert_true(s.turn_order[3].is_downed, "last combatant is downed")
func test_seed_consumables():
var s := ShellState.seed()
assert_eq(s.consumables.size(), 8)
assert_eq(s.consumables[0]["label"], "Salve")
assert_eq(s.consumables[0]["hotkey"], 1)
assert_eq(s.consumables[6]["label"], "", "slot 7 is empty")
func test_toggle_dock_flips():
var s := ShellState.seed()
assert_true(s.dock_open, "seed opens with the dock out")
assert_false(s.toggle_dock())
assert_false(s.dock_open)
assert_true(s.toggle_dock())
assert_true(s.dock_open)