+
+ #[tokio::test]
+ async fn fails_to_fetch_spent_utxo() {
+ let response = serde_json::json!({ "result": null });
+ let server = HttpServer::responding_with_ok(MessageBody::Content(response));
+ let client = RpcClient::new(CREDENTIALS, server.endpoint()).unwrap();
+ let outpoint = OutPoint::new(bitcoin::Txid::from_byte_array([0; 32]), 0);
+ let unspent_output = client.is_output_unspent(outpoint).await.unwrap();
+ assert_eq!(unspent_output, false);
+ }
+
+ #[tokio::test]
+ async fn fetches_utxo() {
+ let response = serde_json::json!({ "result": {"bestblock": 1, "confirmations": 42}});
+ let server = HttpServer::responding_with_ok(MessageBody::Content(response));
+ let client = RpcClient::new(CREDENTIALS, server.endpoint()).unwrap();
+ let outpoint = OutPoint::new(bitcoin::Txid::from_byte_array([0; 32]), 0);
+ let unspent_output = client.is_output_unspent(outpoint).await.unwrap();
+ assert_eq!(unspent_output, true);
+ }