let response = test_server.get("/blockcount");
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text().unwrap(), "2");
}
#[test]
fn block_height_endpoint() {
let test_server = TestServer::new();
let response = test_server.get("/blockheight");
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text().unwrap(), "0");
test_server.mine_blocks(2);
let response = test_server.get("/blockheight");
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text().unwrap(), "2");
}
#[test]
fn block_hash_endpoint() {
let test_server = TestServer::new();
let response = test_server.get("/blockhash");
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(
response.text().unwrap(),
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
);
}
#[test]
fn block_hash_from_height_endpoint() {
let test_server = TestServer::new();
let response = test_server.get("/blockhash/0");