use passwordEncryption::{PasswordHasher, Argon2Impl};
#[test]
fn test_argon2_hash_and_verify() {
let hasher = PasswordHasher::new(Box::new(Argon2Impl::default()));
let password = "test_password";
let hashed_result = hasher.hash_password(password);
assert!(hashed_result.is_ok());
let hashed = hashed_result.unwrap();
let verify_result = hasher.verify_password(password, &hashed);
assert!(verify_result.is_ok());
assert!(verify_result.unwrap());
let wrong_password_result = hasher.verify_password("wrong_password", &hashed);
assert!(wrong_password_result.is_ok());
assert!(!wrong_password_result.unwrap());
}
#[test]
fn test_empty_password() {
let hasher = PasswordHasher::new(Box::new(Argon2Impl::default()));
let password = "";
let hashed_result = hasher.hash_password(password);
assert!(hashed_result.is_ok());
let hashed = hashed_result.unwrap();
let verify_result = hasher.verify_password(password, &hashed);
assert!(verify_result.is_ok());
assert!(verify_result.unwrap());
}