1
use chrono::Utc;
2
use uuid::Uuid;
3
use web::model::{LoginUserSchema, RegisterUserSchema, User};
4

            
5
#[test]
6
1
fn test_user_creation() {
7
1
    let user = User {
8
1
        id: Uuid::new_v4(),
9
1
        name: "Test User".to_string(),
10
1
        email: "test@example.com".to_string(),
11
1
        role: "user".to_string(),
12
1
        photo: String::new(),
13
1
        verified: false,
14
1
        created_at: Some(Utc::now()),
15
1
        updated_at: Some(Utc::now()),
16
1
    };
17

            
18
1
    assert_eq!(user.name, "Test User");
19
1
    assert_eq!(user.email, "test@example.com");
20
1
    assert_eq!(user.role, "user");
21
1
    assert!(!user.verified);
22
1
}
23

            
24
#[test]
25
1
fn test_login_schema() {
26
1
    let login_data = LoginUserSchema {
27
1
        email: "test@example.com".to_string(),
28
1
        password: "password123".to_string(),
29
1
    };
30

            
31
1
    assert_eq!(login_data.email, "test@example.com");
32
1
    assert_eq!(login_data.password, "password123");
33
1
}
34

            
35
#[test]
36
1
fn test_register_schema() {
37
1
    let register_data = RegisterUserSchema {
38
1
        name: "John Doe".to_string(),
39
1
        email: "john@example.com".to_string(),
40
1
        password: "securepassword".to_string(),
41
1
    };
42

            
43
1
    assert_eq!(register_data.name, "John Doe");
44
1
    assert_eq!(register_data.email, "john@example.com");
45
1
    assert_eq!(register_data.password, "securepassword");
46
1
}