20 lines
584 B
GDScript
20 lines
584 B
GDScript
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
|