fix(sonarr): Pass the episode file ID alongside all DeleteEpisodeFile events when publishing to the networking channel

This commit is contained in:
2024-12-17 22:33:10 -07:00
parent 6c5a73f78f
commit aece20af47
6 changed files with 86 additions and 84 deletions
@@ -351,6 +351,37 @@ mod tests {
assert!(result.is_ok());
}
#[tokio::test]
async fn test_handle_delete_episode_file_command() {
let expected_episode_file_id = 1;
let mut mock_network = MockNetworkTrait::new();
mock_network
.expect_handle_network_event()
.with(eq::<NetworkEvent>(
SonarrEvent::DeleteEpisodeFile(expected_episode_file_id).into(),
))
.times(1)
.returning(|_| {
Ok(Serdeable::Sonarr(SonarrSerdeable::Value(
json!({"testResponse": "response"}),
)))
});
let app_arc = Arc::new(Mutex::new(App::default()));
let delete_episode_file_command = SonarrDeleteCommand::EpisodeFile {
episode_file_id: 1,
};
let result = SonarrDeleteCommandHandler::with(
&app_arc,
delete_episode_file_command,
&mut mock_network,
)
.handle()
.await;
assert!(result.is_ok());
}
#[tokio::test]
async fn test_handle_delete_indexer_command() {
let expected_indexer_id = 1;