Lines
100 %
Functions
Branches
use super::*;
async fn body_of(response: Response) -> String {
let bytes = axum::body::to_bytes(response.into_body(), usize::MAX)
.await
.unwrap_or_default();
String::from_utf8_lossy(&bytes).into_owned()
}
#[tokio::test]
async fn the_result_names_both_accounts_and_offers_no_merge() {
let done = Merged {
into: uuid::Uuid::from_u128(1),
from: uuid::Uuid::from_u128(2),
moved: 2,
};
let response = merged(done, &References::default());
assert_eq!(
response
.headers()
.get("hx-retarget")
.map(HeaderValue::as_bytes),
Some(b"#nf-account-merge".as_slice())
);
let html = body_of(response).await;
assert!(html.contains("2 splits moved"), "{html}");
assert!(
html.contains(&uuid::Uuid::from_u128(1).to_string()),
"{html}"
html.contains(&uuid::Uuid::from_u128(2).to_string()),
assert!(!html.contains("<button"), "{html}");
assert!(html.contains("href=\"/account/merge\""), "{html}");
assert!(html.contains("href=\"/account/list\""), "{html}");