MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_empty_result

Function test_empty_result

plugins/lsps-plugin/src/proto/jsonrpc.rs:504–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

502
503 #[test]
504 fn test_empty_result() {
505 // Check that we correctly deserialize an empty result.
506 #[derive(Debug, Serialize, Deserialize, PartialEq)]
507 pub struct DummyResponse {}
508
509 let json_response = r#"
510 {
511 "jsonrpc": "2.0",
512 "result": {},
513 "id": "unique-id-123"
514 }"#;
515
516 let response: JsonRpcResponse<DummyResponse> = serde_json::from_str(json_response).unwrap();
517 let result = response.into_result().unwrap();
518 assert_eq!(result, DummyResponse {});
519 }
520 #[test]
521 fn test_error_deserialization() {
522 // Check that we deserialize an error if we got one.

Callers

nothing calls this directly

Calls 2

into_resultMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected