Skip to content

Commit

Permalink
chore: add test for /v1/keysets
Browse files Browse the repository at this point in the history
  • Loading branch information
ngutech21 committed Dec 15, 2023
1 parent 2885911 commit 1dcb373
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions moksha-mint/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,4 +821,22 @@ mod tests {
);
Ok(())
}

#[tokio::test]
async fn test_get_v1_keysets() -> anyhow::Result<()> {
let app = app(create_mock_mint(Default::default()), None, None);
let response = app
.oneshot(Request::builder().uri("/v1/keysets").body(Body::empty())?)
.await?;

assert_eq!(response.status(), StatusCode::OK);
let body = response.into_body().collect().await.unwrap().to_bytes();
let keys: V1Keysets = serde_json::from_slice(&body)?;
assert_eq!(1, keys.keysets.len());
let keyset = keys.keysets.get(0).expect("keyset not found");
assert!(keyset.active);
assert_eq!(CurrencyUnit::Sat, keyset.unit);
assert_eq!("00e777893f6faa27", keyset.id);
Ok(())
}
}

0 comments on commit 1dcb373

Please sign in to comment.