1
use super::*;
2
use crate::model::User;
3
use axum::http::StatusCode;
4

            
5
2
fn auth() -> JWTAuthMiddleware {
6
2
    JWTAuthMiddleware {
7
2
        user: User {
8
2
            id: Uuid::from_u128(1),
9
2
            name: String::new(),
10
2
            email: String::new(),
11
2
            role: String::new(),
12
2
            photo: String::new(),
13
2
            verified: true,
14
2
            created_at: None,
15
2
            updated_at: None,
16
2
        },
17
2
        access_token_uuid: Uuid::from_u128(2),
18
2
        refreshed: false,
19
2
    }
20
2
}
21

            
22
#[tokio::test]
23
2
async fn delete_rejects_a_malformed_transaction_id() {
24
2
    let err = transaction_delete_submit(Path("nope".to_string()), Extension(auth()))
25
2
        .await
26
        .map(|_| ())
27
        .unwrap_err();
28
2
    assert_eq!(err.status, StatusCode::BAD_REQUEST);
29
2
    assert_eq!(err.message, "Invalid transaction ID format");
30
2
}