20 lines
1.1 KiB
Rust
20 lines
1.1 KiB
Rust
// file: crates/ksp-onchain-transport-lib/unit_tests/rpc_tokens.rs
|
|
// version: 1
|
|
|
|
#[test]
|
|
fn token_selector_is_exclusive_by_construction() {
|
|
let mint = "11111111111111111111111111111111".parse::<ksp_core_lib::Pubkey>().expect("fixture pubkey must parse");
|
|
assert_eq!(crate::SolanaTokenAccountSelector::Mint(mint).to_json_value(), serde_json::json!({"mint":"11111111111111111111111111111111"}));
|
|
assert_eq!(crate::SolanaTokenAccountSelector::ProgramId(mint).to_json_value(), serde_json::json!({"programId":"11111111111111111111111111111111"}));
|
|
}
|
|
|
|
#[test]
|
|
fn token_amount_fixture_preserves_nullable_ui_amount() {
|
|
let value: serde_json::Value = serde_json::from_str(include_str!("../fixtures/http/token_amount.null_ui.json")).expect("fixture must decode");
|
|
let amount = crate::SolanaTokenAmount::decode_wire("fixture", value).expect("token amount must decode");
|
|
assert_eq!(amount.amount(), "18446744073709551615");
|
|
assert_eq!(amount.decimals(), 9);
|
|
assert_eq!(amount.ui_amount(), std::option::Option::None);
|
|
assert_eq!(amount.ui_amount_string(), "18446744073.709551615");
|
|
}
|