mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 06:34:54 +08:00
test(api): 固化 Rust-Go RPC 契约
This commit is contained in:
@@ -8951,6 +8951,36 @@ mod tests {
|
||||
assert_eq!(value["error"]["code"], "BAT-ERR-700002");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dispatch_unityfs_patch_methods_are_live_handlers_and_require_params() {
|
||||
let temp = tempfile::TempDir::new().unwrap();
|
||||
let control = new_daemon_control();
|
||||
for method in [
|
||||
"unityfs.patch_text_asset",
|
||||
"unityfs.patch_string_field",
|
||||
"unityfs.patch_field",
|
||||
] {
|
||||
let envelope = dispatch_rpc_method(
|
||||
&rpc_request(method, None),
|
||||
temp.path(),
|
||||
&control,
|
||||
&test_task_context(),
|
||||
format!("req-test-{method}"),
|
||||
);
|
||||
let value = serde_json::to_value(&envelope).unwrap();
|
||||
assert_eq!(value["ok"], false, "method={method}");
|
||||
assert_eq!(value["error"]["code"], "BAT-ERR-700002", "method={method}");
|
||||
assert_eq!(value["error"]["location"], method, "method={method}");
|
||||
assert!(
|
||||
value["error"]["message"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.contains("params 不能为空"),
|
||||
"method={method}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dispatch_patch_apply_writes_text_patch_target() {
|
||||
let temp = tempfile::TempDir::new().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user