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

Function test_call

cln-rpc/src/lib.rs:136–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135 #[tokio::test]
136 async fn test_call() {
137 let req = Request::Getinfo(requests::GetinfoRequest {});
138 let (uds1, uds2) = UnixStream::pair().unwrap();
139 let mut cln = ClnRpc::from_stream(uds1).unwrap();
140
141 let mut read = FramedRead::new(uds2, JsonCodec::default());
142 tokio::task::spawn(async move {
143 cln.call(req).await.unwrap();
144 });
145
146 let read_req = dbg!(read.next().await.unwrap().unwrap());
147
148 assert_eq!(
149 json!({"id": "1", "method": "getinfo", "params": {}, "jsonrpc": "2.0"}),
150 read_req
151 );
152 }
153
154 #[tokio::test]
155 async fn test_typed_call() {

Callers

nothing calls this directly

Calls 2

unwrapMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected