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

            
6
#[test]
7
2
fn the_updated_message_names_the_id() {
8
2
    let id = Uuid::from_u128(7);
9
2
    assert_eq!(updated_message(id), format!("Script updated: {id}"));
10
2
}
11

            
12
#[test]
13
2
fn the_script_id_must_be_a_uuid() {
14
2
    let id = Uuid::from_u128(7);
15
2
    assert_eq!(parse_script_id(&id.to_string()).ok(), Some(id));
16
2
    assert!(parse_script_id("nope").is_err());
17
2
}
18

            
19
#[test]
20
2
fn the_browser_fixture_of_the_script_edit_form_is_up_to_date() {
21
2
    let id = Uuid::from_u128(7);
22
2
    let mut values = FormValues::default();
23
2
    values.set("id", &id.to_string());
24
2
    values.set("revision", "r1");
25
2
    values.set("name", "tag-sync");
26
2
    values.set("source", "(+ 1 2)");
27
2
    values.set("enabled", "true");
28
2
    let reload = EDIT.page.replace("{id}", &id.to_string());
29
2
    let html = render_form_reloading(
30
2
        &SCRIPT_EDIT,
31
2
        &values,
32
2
        &[],
33
2
        SUBMIT_PATH,
34
2
        &References::default(),
35
2
        &reload,
36
2
    )
37
2
    .expect("renders");
38
2
    assert_fixture("script_edit.html", &html);
39
2
}