server: make state-save debounce timing configurable
This commit is contained in:
@@ -10,6 +10,8 @@ def test_load_config_defaults_when_path_none() -> None:
|
||||
assert cfg.server.bind_ip == "127.0.0.1"
|
||||
assert cfg.network.allow_insecure_ws is True
|
||||
assert cfg.storage.state_file == "runtime/items.json"
|
||||
assert cfg.storage.state_save_debounce_ms == 200
|
||||
assert cfg.storage.state_save_max_delay_ms == 1000
|
||||
assert cfg.world.grid_size == 41
|
||||
|
||||
|
||||
@@ -23,3 +25,18 @@ allow_insecure_ws = false
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
load_config(config_path)
|
||||
|
||||
|
||||
def test_load_config_reads_state_save_timing(tmp_path: Path) -> None:
|
||||
config_path = tmp_path / "config.toml"
|
||||
config_path.write_text(
|
||||
"""
|
||||
[storage]
|
||||
state_file = "runtime/items.json"
|
||||
state_save_debounce_ms = 150
|
||||
state_save_max_delay_ms = 900
|
||||
""".strip()
|
||||
)
|
||||
cfg = load_config(config_path)
|
||||
assert cfg.storage.state_save_debounce_ms == 150
|
||||
assert cfg.storage.state_save_max_delay_ms == 900
|
||||
|
||||
Reference in New Issue
Block a user