diff --git a/crates/domain/src/models/tests.rs b/crates/domain/src/models/tests.rs index 4900a21..cc9f97e 100644 --- a/crates/domain/src/models/tests.rs +++ b/crates/domain/src/models/tests.rs @@ -10,13 +10,16 @@ fn make_user() -> User { UserRole::Standard, None, None, + None, + None, + vec![], ) } #[test] fn update_profile_sets_fields() { let mut user = make_user(); - user.update_profile(Some("My bio".to_string()), Some("avatars/abc".to_string())); + user.update_profile(Some("My bio".to_string()), Some("avatars/abc".to_string()), None, None); assert_eq!(user.bio(), Some("My bio")); assert_eq!(user.avatar_path(), Some("avatars/abc")); } @@ -24,8 +27,8 @@ fn update_profile_sets_fields() { #[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); + user.update_profile(Some("bio".to_string()), Some("path".to_string()), None, None); + user.update_profile(None, None, None, None); assert_eq!(user.bio(), None); assert_eq!(user.avatar_path(), None); } diff --git a/crates/presentation/src/tests/extractors.rs b/crates/presentation/src/tests/extractors.rs index 0167e48..1c82326 100644 --- a/crates/presentation/src/tests/extractors.rs +++ b/crates/presentation/src/tests/extractors.rs @@ -215,11 +215,16 @@ impl UserRepository for Panic { async fn list_with_stats(&self) -> Result, DomainError> { panic!() } - async fn update_profile(&self, _: &UserId, _: Option, _: Option) -> Result<(), DomainError> { + async fn update_profile(&self, _: &UserId, _: Option, _: Option, _: Option, _: Option) -> Result<(), DomainError> { panic!() } } #[async_trait::async_trait] +impl domain::ports::UserProfileFieldsRepository for Panic { + async fn get_fields(&self, _: &UserId) -> Result, DomainError> { panic!() } + async fn set_fields(&self, _: &UserId, _: Vec) -> Result<(), DomainError> { panic!() } +} +#[async_trait::async_trait] impl EventPublisher for Panic { async fn publish(&self, _: &DomainEvent) -> Result<(), DomainError> { panic!() @@ -414,6 +419,7 @@ pub fn make_test_state(auth_service: Arc) -> crate::state::AppS import_profile_repository: Arc::clone(&repo) as _, movie_profile_repository: Arc::clone(&repo) as _, watchlist_repository: Arc::clone(&repo) as _, + profile_fields_repository: Arc::clone(&repo) as _, #[cfg(feature = "federation")] remote_watchlist_repository: Arc::clone(&repo) as _, person_command: Arc::clone(&repo) as _, diff --git a/crates/presentation/tests/api_test.rs b/crates/presentation/tests/api_test.rs index 4c6d364..c1afa59 100644 --- a/crates/presentation/tests/api_test.rs +++ b/crates/presentation/tests/api_test.rs @@ -109,11 +109,18 @@ impl UserRepository for NobodyUserRepo { async fn list_with_stats(&self) -> Result, DomainError> { panic!() } - async fn update_profile(&self, _: &UserId, _: Option, _: Option) -> Result<(), DomainError> { + async fn update_profile(&self, _: &UserId, _: Option, _: Option, _: Option, _: Option) -> Result<(), DomainError> { Ok(()) } } +struct PanicProfileFields; +#[async_trait] +impl domain::ports::UserProfileFieldsRepository for PanicProfileFields { + async fn get_fields(&self, _: &UserId) -> Result, DomainError> { Ok(vec![]) } + async fn set_fields(&self, _: &UserId, _: Vec) -> Result<(), DomainError> { panic!() } +} + struct PanicExporter; #[async_trait] impl domain::ports::DiaryExporter for PanicExporter { @@ -259,6 +266,7 @@ async fn test_app() -> Router { import_profile_repository: Arc::new(PanicImportProfile), movie_profile_repository: Arc::new(PanicMovieProfile), watchlist_repository: Arc::new(PanicWatchlist), + profile_fields_repository: Arc::new(PanicProfileFields), #[cfg(feature = "federation")] remote_watchlist_repository: Arc::new(PanicRemoteWatchlist), person_command: Arc::new(PanicPersonCommand),