Lines
100 %
Functions
Branches
use chrono::Utc;
use uuid::Uuid;
use web::model::{LoginUserSchema, RegisterUserSchema, User};
#[test]
fn test_user_creation() {
let user = User {
id: Uuid::new_v4(),
name: "Test User".to_string(),
email: "test@example.com".to_string(),
password: "hashedpassword".to_string(),
role: "user".to_string(),
photo: "".to_string(),
verified: false,
database: "testdb".to_string(),
created_at: Some(Utc::now()),
updated_at: Some(Utc::now()),
};
assert_eq!(user.name, "Test User");
assert_eq!(user.email, "test@example.com");
assert_eq!(user.role, "user");
assert!(!user.verified);
}
fn test_login_schema() {
let login_data = LoginUserSchema {
password: "password123".to_string(),
assert_eq!(login_data.email, "test@example.com");
assert_eq!(login_data.password, "password123");
fn test_register_schema() {
let register_data = RegisterUserSchema {
name: "John Doe".to_string(),
email: "john@example.com".to_string(),
password: "securepassword".to_string(),
assert_eq!(register_data.name, "John Doe");
assert_eq!(register_data.email, "john@example.com");
assert_eq!(register_data.password, "securepassword");