refactor: move inline tests to separate files via #[path]

This commit is contained in:
2026-05-12 16:39:58 +02:00
parent 00218366da
commit 763d622601
58 changed files with 3267 additions and 3267 deletions

View File

@@ -457,39 +457,8 @@ pub enum ExportFormat {
}
#[cfg(test)]
mod tests {
use super::*;
use crate::value_objects::{Email, PasswordHash, UserId, Username};
fn make_user() -> User {
User::from_persistence(
UserId::generate(),
Email::new("a@b.com".to_string()).unwrap(),
Username::new("alice".to_string()).unwrap(),
PasswordHash::new("hash".to_string()).unwrap(),
UserRole::Standard,
None,
None,
)
}
#[test]
fn update_profile_sets_fields() {
let mut user = make_user();
user.update_profile(Some("My bio".to_string()), Some("avatars/abc".to_string()));
assert_eq!(user.bio(), Some("My bio"));
assert_eq!(user.avatar_path(), Some("avatars/abc"));
}
#[test]
fn update_profile_clears_with_none() {
let mut user = make_user();
user.update_profile(Some("bio".to_string()), Some("path".to_string()));
user.update_profile(None, None);
assert_eq!(user.bio(), None);
assert_eq!(user.avatar_path(), None);
}
}
#[path = "tests.rs"]
mod tests;
// ── Movie enrichment ───────────────────────────────────────────────────────────

View File

@@ -0,0 +1,31 @@
use super::*;
use crate::value_objects::{Email, PasswordHash, UserId, Username};
fn make_user() -> User {
User::from_persistence(
UserId::generate(),
Email::new("a@b.com".to_string()).unwrap(),
Username::new("alice".to_string()).unwrap(),
PasswordHash::new("hash".to_string()).unwrap(),
UserRole::Standard,
None,
None,
)
}
#[test]
fn update_profile_sets_fields() {
let mut user = make_user();
user.update_profile(Some("My bio".to_string()), Some("avatars/abc".to_string()));
assert_eq!(user.bio(), Some("My bio"));
assert_eq!(user.avatar_path(), Some("avatars/abc"));
}
#[test]
fn update_profile_clears_with_none() {
let mut user = make_user();
user.update_profile(Some("bio".to_string()), Some("path".to_string()));
user.update_profile(None, None);
assert_eq!(user.bio(), None);
assert_eq!(user.avatar_path(), None);
}