Skip to content

Commit

Permalink
#[test] output_recursive_endpoint()
Browse files Browse the repository at this point in the history
  • Loading branch information
1stBitcoinSent committed Dec 14, 2024
1 parent 4fa2d73 commit bb171e7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6341,6 +6341,46 @@ next
);
}

#[test]
fn output_recursive_endpoint() {
let server = TestServer::builder().chain(Chain::Regtest).build();

server.mine_blocks(1);

let inscription = Inscription {
content_type: Some("text/plain".into()),
body: Some("foo".into()),
..default()
};

let txid = server.core.broadcast_tx(TransactionTemplate {
inputs: &[(1, 0, 0, inscription.to_witness())],
..default()
});

server.mine_blocks(1);

let inscription_id = InscriptionId { txid, index: 0 };
let outpoint: OutPoint = OutPoint { txid, vout: 0 };

let output_response = server.get_json::<api::Output>(
format!("/r/output/{}", outpoint)
);

assert_eq!(output_response.outpoint, outpoint);
assert!(!output_response.spent);
assert!(output_response.indexed);
assert_eq!(output_response.inscriptions, vec![inscription_id]);
assert!(output_response.address.is_some());
assert!(!output_response.script_pubkey.is_empty());
assert_eq!(output_response.transaction, txid);
assert!(output_response.value > 0);
assert!(output_response.runes.is_empty());
if let Some(sat_ranges) = &output_response.sat_ranges {
assert!(!sat_ranges.is_empty());
}
}

#[test]
fn sat_recursive_endpoints() {
let server = TestServer::builder()
Expand Down

0 comments on commit bb171e7

Please sign in to comment.