test: cascading in-memory store

This commit is contained in:
2026-10-25 22:19:24 +01:00
parent 51d92e08a7
commit 06eec2feae
72 changed files with 2439 additions and 1627 deletions

View File

@@ -4,13 +4,8 @@ use application::config::AppConfig;
use domain::testing::{
FakeAuthService, FakeDocumentParser, FakeMetadataClient, FakePasswordHasher, FakePersonQuery,
FakePosterFetcher, FakeSearchCommand, FakeSearchPort, FakeStatsRepository,
InMemoryGoalRepository, InMemoryImportProfileRepository, InMemoryImportSessionRepository,
InMemoryInsightsQuery, InMemoryMovieProfileRepository, InMemoryMovieRepository,
InMemoryProfileFieldsRepo, InMemoryRefreshSessionRepository, InMemoryReviewRepository,
InMemorySocialRepository, InMemoryUserRepository, InMemoryUserSettingsRepository,
InMemoryWatchEventRepository, InMemoryWatchlistRepository, InMemoryWebhookTokenRepository,
InMemoryWrapUpRepository, InMemoryWrapUpStatsQuery, NoopEventPublisher,
NoopFederationAdminQuery, NoopObjectStorage, NoopRemoteGoalRepository,
InMemoryInsightsQuery, InMemoryStore, InMemoryWrapUpRepository, InMemoryWrapUpStatsQuery,
NoopEventPublisher, NoopFederationAdminQuery, NoopObjectStorage, NoopRemoteGoalRepository,
NoopRemoteWatchlistRepository, PanicDiaryExporter, PanicPersonCommand,
};
@@ -92,7 +87,7 @@ impl domain::ports::ImageRefQuery for NoopImageRefQuery {
}
/// `DatabaseOutput::follow_command`/`follow_query` need a fake independent of
/// `InMemorySocialRepository` (domain::testing), which implements
/// `InMemoryStore` (domain::testing), which implements
/// `SocialCommand`/`FollowGraphQuery`/`BlockQuery` — the composite ports these
/// two feed, one level up — so it cannot stand in as their dependency. These
/// fixture fields are never exercised by `build_deps`/`build_worker_deps`
@@ -223,30 +218,30 @@ impl domain::ports::FollowQuery for NoopFollowQuery {
}
fn test_repositories() -> Repositories {
let movies = InMemoryMovieRepository::new();
let watch_events = InMemoryWatchEventRepository::new();
let goals = InMemoryGoalRepository::new();
let social = InMemorySocialRepository::new();
let movies = InMemoryStore::new();
let watch_events = Arc::clone(&movies);
let goals = Arc::clone(&movies);
let social = Arc::clone(&movies);
Repositories {
movie_command: Arc::clone(&movies) as _,
movie_query: movies as _,
review: InMemoryReviewRepository::new(),
review: InMemoryStore::new(),
diary: domain::testing::FakeDiaryQuery::new(),
stats: FakeStatsRepository::new(),
user: InMemoryUserRepository::new(),
import_session: InMemoryImportSessionRepository::new(),
import_profile: InMemoryImportProfileRepository::new(),
movie_profile: InMemoryMovieProfileRepository::new(),
watchlist: InMemoryWatchlistRepository::new(),
user: InMemoryStore::new(),
import_session: InMemoryStore::new(),
import_profile: InMemoryStore::new(),
movie_profile: InMemoryStore::new(),
watchlist: InMemoryStore::new(),
watch_event_command: Arc::clone(&watch_events) as _,
watch_event_query: watch_events as _,
webhook_token: InMemoryWebhookTokenRepository::new(),
webhook_token: InMemoryStore::new(),
person_command: Arc::new(PanicPersonCommand),
person_query: Arc::new(FakePersonQuery),
search_port: Arc::new(FakeSearchPort),
search_command: Arc::new(FakeSearchCommand),
profile_fields: InMemoryProfileFieldsRepo::new(),
profile_fields: InMemoryStore::new(),
remote_watchlist: Arc::new(NoopRemoteWatchlistRepository),
social_command: Arc::clone(&social) as _,
follow_graph: Arc::clone(&social) as _,
@@ -257,9 +252,9 @@ fn test_repositories() -> Repositories {
insights: InMemoryInsightsQuery::new(),
goal_command: Arc::clone(&goals) as _,
goal_query: goals as _,
user_settings: InMemoryUserSettingsRepository::new(),
user_settings: InMemoryStore::new(),
remote_goal: Arc::new(NoopRemoteGoalRepository),
refresh_session: InMemoryRefreshSessionRepository::new(),
refresh_session: InMemoryStore::new(),
federated_profile: None,
}
}
@@ -274,30 +269,30 @@ fn test_db_pool() -> crate::DbPool {
}
fn test_database_output() -> DatabaseOutput {
let movies = InMemoryMovieRepository::new();
let watch_events = InMemoryWatchEventRepository::new();
let goals = InMemoryGoalRepository::new();
let user_settings = InMemoryUserSettingsRepository::new();
let movies = InMemoryStore::new();
let watch_events = Arc::clone(&movies);
let goals = Arc::clone(&movies);
let user_settings = Arc::clone(&movies);
DatabaseOutput {
movie_command: Arc::clone(&movies) as _,
movie_query: movies as _,
review: InMemoryReviewRepository::new(),
review: InMemoryStore::new(),
diary: domain::testing::FakeDiaryQuery::new(),
stats: FakeStatsRepository::new(),
user: InMemoryUserRepository::new(),
import_session: InMemoryImportSessionRepository::new(),
import_profile: InMemoryImportProfileRepository::new(),
movie_profile: InMemoryMovieProfileRepository::new(),
watchlist: InMemoryWatchlistRepository::new(),
user: InMemoryStore::new(),
import_session: InMemoryStore::new(),
import_profile: InMemoryStore::new(),
movie_profile: InMemoryStore::new(),
watchlist: InMemoryStore::new(),
watch_event_command: Arc::clone(&watch_events) as _,
watch_event_query: watch_events as _,
webhook_token: InMemoryWebhookTokenRepository::new(),
webhook_token: InMemoryStore::new(),
person_command: Arc::new(PanicPersonCommand),
person_query: Arc::new(FakePersonQuery),
search_port: Arc::new(FakeSearchPort),
search_command: Arc::new(FakeSearchCommand),
profile_fields: InMemoryProfileFieldsRepo::new(),
profile_fields: InMemoryStore::new(),
ap_content: Arc::new(NoopLocalApContentQuery),
wrapup_stats: InMemoryWrapUpStatsQuery::new(),
wrapup_repo: InMemoryWrapUpRepository::new(),
@@ -307,7 +302,7 @@ fn test_database_output() -> DatabaseOutput {
user_settings: Arc::clone(&user_settings) as _,
federation_settings: user_settings as _,
remote_goal: Arc::new(NoopRemoteGoalRepository),
refresh_session: InMemoryRefreshSessionRepository::new(),
refresh_session: InMemoryStore::new(),
deduplicator: Arc::new(NoopMovieDeduplicator),
image_ref_command: Arc::new(NoopImageRefCommand),
image_ref_query: Arc::new(NoopImageRefQuery),