Lines
100 %
Functions
Branches
//! The web transaction list behaviour W0a pinned, as W7 flipped it.
use axum::http::StatusCode;
use crate::common::list_page::{add, list, listed_notes};
use crate::common::new_page::seeded_user;
/// Flipped in W7: an unparseable `from` or `to` was dropped without an error
/// and the list was unfiltered; it is now an inline field error.
#[supp_macro::shared_runtime_test]
async fn bad_list_date_filter_is_reported_inline() {
let user = seeded_user().await;
add(
&user,
"2020-03-04T05:06:00Z",
"needle-note",
"Expenses:Food",
"5",
)
.await;
let valid = list(&user, "from=2030-01-01").await;
assert_eq!(valid.status, StatusCode::OK, "{}", valid.body);
assert!(
listed_notes(&valid.body).is_empty(),
"a valid filter must exclude"
);
let bad = list(&user, "from=not-a-date&to=31.31.2020").await;
assert_eq!(bad.status, StatusCode::UNPROCESSABLE_ENTITY, "{}", bad.body);
assert!(!bad.body.contains("needle-note"), "{}", bad.body);
assert_eq!(bad.body.matches("class=\"field-error\"").count(), 2);
}