feat(client): DmService narrate loop + FakeDmTransport (all branches tested)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
client/tests/doubles/fake_transport.gd
Normal file
19
client/tests/doubles/fake_transport.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends "res://scripts/net/dm_transport.gd"
|
||||
## Test double for DmTransport. Returns a canned DmResponse and records the last
|
||||
## call so tests can assert what the service posted. post_json needs no real
|
||||
## async — awaiting a plain return value resolves immediately, so the same await
|
||||
## call site in DmService drives both the real and the fake transport.
|
||||
|
||||
var _canned
|
||||
var last_path: String
|
||||
var last_body: Dictionary
|
||||
|
||||
|
||||
func set_response(resp) -> void:
|
||||
_canned = resp
|
||||
|
||||
|
||||
func post_json(path: String, body: Dictionary) -> DmResponse:
|
||||
last_path = path
|
||||
last_body = body
|
||||
return _canned
|
||||
Reference in New Issue
Block a user