test: refusing fakes, failure-path tests, shared panic stubs

This commit is contained in:
2026-10-25 22:25:36 +01:00
parent 06eec2feae
commit 5256c6e851
12 changed files with 555 additions and 825 deletions

View File

@@ -90,3 +90,21 @@ async fn test_add_to_watchlist_movie_not_found_by_id() {
assert!(add::execute(&deps, cmd).await.is_err());
}
#[tokio::test]
async fn adding_the_same_movie_to_a_watchlist_twice_keeps_a_single_entry_and_succeeds() {
let movies = InMemoryStore::new();
let movie = test_movie_with_year("Heat", 1995);
let movie_uuid = movie.id().value();
let user_id = uuid::Uuid::new_v4();
movies.upsert_movie(&movie).await.unwrap();
let deps = make_deps(Arc::clone(&movies), Arc::clone(&movies));
for _ in 0..2 {
add::execute(&deps, add_to_watchlist_command(user_id, movie_uuid))
.await
.expect("second add must not error");
}
assert_eq!(movies.watchlist_count(), 1);
}