Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

chore: remove unit tests and keep code clean

Samir Hossains8c2fea96ae52
diff --git a/src/providers/addons/models.rs b/src/providers/addons/models.rs
index e15cd38..c5e13f1 100644
--- a/src/providers/addons/models.rs
+++ b/src/providers/addons/models.rs
@@ -479,45 +479,3 @@ impl InstalledAddon {
}
}
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn test_deserialize_cinemeta_detail() {
- let json_str = r#"{
- "meta": {
- "id": "tt1375666",
- "name": "Inception",
- "type": "movie",
- "year": "2010",
- "releaseInfo": "2010",
- "released": "2010-07-16T00:00:00.000Z",
- "imdbRating": "8.8",
- "description": "A thief who steals corporate secrets...",
- "director": ["Christopher Nolan"],
- "cast": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"],
- "genre": ["Action", "Sci-Fi"],
- "genres": ["Action", "Sci-Fi"],
- "runtime": "148 min",
- "poster": "https://example.com/poster.jpg",
- "videos": []
- }
- }"#;
-
- let val: serde_json::Value = serde_json::from_str(json_str).unwrap();
- let meta = val.get("meta").unwrap().clone();
- let detail: MetaDetail =
- serde_json::from_value(meta).expect("Failed to deserialize MetaDetail");
- assert_eq!(detail.id, "tt1375666");
- assert_eq!(detail.name, "Inception");
- assert_eq!(detail.imdb_rating.as_deref(), Some("8.8"));
- assert_eq!(detail.director, vec!["Christopher Nolan"]);
- assert_eq!(
- detail.cast,
- vec!["Leonardo DiCaprio", "Joseph Gordon-Levitt"]
- );
- assert_eq!(detail.genres, vec!["Action", "Sci-Fi"]);
- }
-}
diff --git a/src/service.rs b/src/service.rs
index 60be734..012ffe8 100644
--- a/src/service.rs
+++ b/src/service.rs
@@ -491,23 +491,3 @@ pub fn resolve_download_dir(custom_dir: Option<&Path>) -> PathBuf {
ensure_moviebox_subdir(&base_dir)
}
-
-#[cfg(test)]
-mod tests {
- #[tokio::test]
- async fn test_addon_fetch_meta_live() {
- let client = crate::providers::addons::AddonClient::new();
- let res = client
- .fetch_meta("https://v3-cinemeta.strem.io", "movie", "tt1375666")
- .await;
- assert!(res.is_ok(), "fetch_meta failed: {:?}", res.err());
- let meta = res.unwrap();
- let json = crate::providers::addons::adapter::meta_detail_to_moviebox_json(&meta);
- println!(
- "meta_detail_to_moviebox_json: {}",
- serde_json::to_string_pretty(&json).unwrap()
- );
- assert_eq!(meta.id, "tt1375666");
- assert_eq!(meta.name, "Inception");
- }
-}
diff --git a/src/tui/commands.rs b/src/tui/commands.rs
index 2677c56..5e6b5c5 100644
--- a/src/tui/commands.rs
+++ b/src/tui/commands.rs
@@ -182,50 +182,3 @@ impl SlashCommand {
}
}
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn test_mode_availability() {
- let mut state = AppState::default();
-
- let streaming_commands = SlashCommand::suggest(&state, "/");
- assert!(streaming_commands.contains(&SlashCommand::Browse));
- assert!(streaming_commands.contains(&SlashCommand::History));
- assert!(!streaming_commands.contains(&SlashCommand::List));
- assert!(!streaming_commands.contains(&SlashCommand::Config));
-
- state.is_tv_mode = true;
- let tv_commands = SlashCommand::suggest(&state, "/");
- assert!(tv_commands.contains(&SlashCommand::List));
- assert!(tv_commands.contains(&SlashCommand::Config));
- assert!(tv_commands.contains(&SlashCommand::Reload));
- assert!(!tv_commands.contains(&SlashCommand::Browse));
- assert!(!tv_commands.contains(&SlashCommand::History));
-
- state.is_tv_mode = false;
- state.is_addon_mode = true;
- state.addons_enabled = true;
- let addon_commands = SlashCommand::suggest(&state, "/");
- assert!(addon_commands.contains(&SlashCommand::Addons));
- assert!(!addon_commands.contains(&SlashCommand::Config));
- assert!(!addon_commands.contains(&SlashCommand::Browse));
- assert!(!addon_commands.contains(&SlashCommand::List));
- }
-
- #[test]
- fn test_parse_slash_commands() {
- assert_eq!(SlashCommand::parse("/browse"), Some(ParsedCommand::Browse));
- assert_eq!(
- SlashCommand::parse("/download-dir ~/Movies"),
- Some(ParsedCommand::DownloadDir("~/Movies"))
- );
- assert_eq!(
- SlashCommand::parse("/download-dir"),
- Some(ParsedCommand::DownloadDir(""))
- );
- assert_eq!(SlashCommand::parse("not a command"), None);
- }
-}