36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
mod utils;
|
|
use utils::{base_url, test_client, validate_json_response};
|
|
use serde_json::Value;
|
|
use tokio;
|
|
|
|
#[tokio::test]
|
|
async fn test_get_circulating_supply() {
|
|
let url = format!("{}/v1/circulating-supply", base_url());
|
|
let res = test_client().get(&url).send().await.unwrap();
|
|
let json = validate_json_response(res).await;
|
|
|
|
assert!(json.get("circulating_supply").is_some(), "Missing 'circulating_supply' field");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_get_circulating_supply_value() {
|
|
let url = format!("{}/v1/circulating-supply/circulating-supply-value", base_url());
|
|
let res = test_client().get(&url).send().await.unwrap();
|
|
let json = validate_json_response(res).await;
|
|
|
|
assert!(json.is_number(), "Expected a number for the circulating supply value");
|
|
let number = json.as_f64().unwrap();
|
|
assert!(number >= 0.0, "Circulating supply should be non-negative");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_get_total_supply_value() {
|
|
let url = format!("{}/v1/circulating-supply/total-supply-value", base_url());
|
|
let res = test_client().get(&url).send().await.unwrap();
|
|
let json = validate_json_response(res).await;
|
|
|
|
assert!(json.is_number(), "Expected a number for total supply value");
|
|
let number = json.as_f64().unwrap();
|
|
assert!(number >= 0.0, "Total supply should be non-negative");
|
|
}
|