1
use super::*;
2
use crate::form_render::fixture::assert_fixture;
3
use crate::form_render::{References, render_form};
4
use forms::FormValues;
5

            
6
#[test]
7
2
fn the_created_message_carries_the_notice() {
8
2
    let id = Uuid::from_u128(7);
9
2
    assert_eq!(created_message(id, None), format!("New account id: {id}"));
10
2
    assert_eq!(
11
2
        created_message(id, Some("twin")),
12
2
        format!("New account id: {id}. twin")
13
    );
14
2
}
15

            
16
#[test]
17
2
fn the_browser_fixture_of_the_account_create_form_is_up_to_date() {
18
2
    let html = render_form(
19
2
        &ACCOUNT_CREATE,
20
2
        &FormValues::default(),
21
2
        &[],
22
2
        SUBMIT_PATH,
23
2
        &References::default(),
24
2
    )
25
2
    .expect("renders");
26
2
    assert_fixture("account_create.html", &html);
27
2
}
28

            
29
#[test]
30
2
fn the_duplicate_notice_is_escaped_in_the_reply() {
31
2
    let message = created_message(Uuid::from_u128(7), Some("<img src=x onerror=1>"));
32
2
    let html = crate::pages::forms::message::escaped(&message).expect("renders");
33
2
    assert!(html.contains("&#60;img"), "{html}");
34
2
    assert!(!html.contains("<img"), "{html}");
35
2
}