Skip to content

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

test: prune redundant assertions, remove comments, and sharpen compact tier test

Samir Hossains474692ee846a
diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rs
index 8239672..e28cd7a 100644
--- a/src/tui/screens/details.rs
+++ b/src/tui/screens/details.rs
@@ -2805,10 +2805,15 @@ mod tests {
],
};
- let area = Rect::new(0, 0, 120, 30);
+ let area = Rect::new(0, 0, 70, 24);
let tier = DetailsLayoutTier::for_area(area);
- let height = tier.header_height(area, Some(&details));
- assert_eq!(height, 8);
+ let height_with_synopsis = tier.header_height(area, Some(&details));
+ assert_eq!(height_with_synopsis, 8);
+
+ let mut details_empty = details.clone();
+ details_empty.description = None;
+ let height_empty = tier.header_height(area, Some(&details_empty));
+ assert_eq!(height_empty, 5);
}
#[test]
diff --git a/tests/content_pipeline.rs b/tests/content_pipeline.rs
index 35cb8a3..b473695 100644
--- a/tests/content_pipeline.rs
+++ b/tests/content_pipeline.rs
@@ -334,7 +334,6 @@ async fn test_search_preview_and_details_metadata_isolation() {
provider: ProviderKind::Addons,
};
- // Mismatched preview should NOT leak description/director/stars/rating into fallback
let fallback = MediaDetails::from_search_result(&new_search_result, Some(&old_preview));
assert_eq!(fallback.id.value, "tt_new_movie");
assert_eq!(fallback.title, "New Movie Title");
@@ -344,7 +343,6 @@ async fn test_search_preview_and_details_metadata_isolation() {
assert!(fallback.stars.is_none());
assert!(fallback.imdb_rating.is_none());
- // Matching preview SHOULD preserve preview details
let matching_preview = MediaDetails {
id: ProviderMediaId {
provider: ProviderKind::Addons,
diff --git a/tests/live_stream_verification.rs b/tests/live_stream_verification.rs
index aba6fdd..311cb17 100644
--- a/tests/live_stream_verification.rs
+++ b/tests/live_stream_verification.rs
@@ -7,7 +7,6 @@ async fn test_live_movie_stream_real_urls() {
let client = MovieBoxClient::new();
client.init().await.expect("client init successful");
- // Ek Deewane Ki Deewaniyat subject_id: 4179386086617137184
let releases = client
.episode_streams("4179386086617137184", 0, 0)
.await
@@ -46,7 +45,6 @@ async fn test_live_series_resolutions_and_streams() {
let client = MovieBoxClient::new();
client.init().await.expect("client init successful");
- // Search for a series dynamically
let search_res = client
.search("Breaking Bad", 1)
.await
@@ -176,7 +174,6 @@ async fn test_inspect_live_mpd_manifest() {
xml
);
- // Test quality switching with mpv
for (target_label, height_constraint, expected_res) in [
(
"1080p",
@@ -397,7 +394,6 @@ async fn test_live_moviebox_session_persistence_and_reuse() {
let token1 = client1.ensure_session().await.expect("ensure session 1");
assert!(!token1.is_empty(), "token1 should not be empty");
- // Client 2 without explicit init should load persisted session
let client2 = MovieBoxClient::new();
let token2 = client2.ensure_session().await.expect("ensure session 2");
assert_eq!(
@@ -405,14 +401,12 @@ async fn test_live_moviebox_session_persistence_and_reuse() {
"client2 must reuse the persisted valid session token"
);
- // Perform search with client 2
let search_res = client2
.search("Inception", 1)
.await
.expect("search with client2");
assert!(!search_res.is_null());
- // Invalidation test
client2.invalidate_session();
let token3 = client2
.ensure_session()
diff --git a/tests/tui_acceptance.rs b/tests/tui_acceptance.rs
index 9c2291a..e12d8d8 100644
--- a/tests/tui_acceptance.rs
+++ b/tests/tui_acceptance.rs
@@ -269,7 +269,6 @@ async fn test_mouse_click_favorites_item_focuses_and_selects() {
);
let card_w = moviebox_tui::tui::screens::home::search_deck_width(area, app.state(), true);
let card_x = area.x + area.width.saturating_sub(card_w) / 2;
- // Header is fav_y + 0, item 0 is fav_y + 1
let item_0_y = landing_rows.rects[landing_rows.favorites].y + 1;
app.handle_action(Action::MouseClick(card_x + 5, item_0_y))
@@ -543,7 +542,6 @@ async fn test_search_cursor_navigation_and_mid_string_editing() {
app.state_mut().input_mode = InputMode::Editing;
app.state_mut().search_query.set_content("avtar");
- // Move left twice to position cursor between 'v' and 't' (pos 2)
let left = KeyEvent::new(KeyCode::Left, KeyModifiers::empty());
app.handle_action(Action::Key(left)).await;
app.handle_action(Action::Key(left)).await;
@@ -551,24 +549,20 @@ async fn test_search_cursor_navigation_and_mid_string_editing() {
app.handle_action(Action::Key(left)).await;
assert_eq!(app.state().search_query.cursor(), 2);
- // Insert 'a' -> "avatar"
let char_a = KeyEvent::new(KeyCode::Char('a'), KeyModifiers::empty());
app.handle_action(Action::Key(char_a)).await;
assert_eq!(app.state().search_query, "avatar");
assert_eq!(app.state().search_query.cursor(), 3);
- // Home -> cursor at 0
let home = KeyEvent::new(KeyCode::Home, KeyModifiers::empty());
app.handle_action(Action::Key(home)).await;
assert_eq!(app.state().search_query.cursor(), 0);
- // Forward delete 'a' -> "vatar"
let delete = KeyEvent::new(KeyCode::Delete, KeyModifiers::empty());
app.handle_action(Action::Key(delete)).await;
assert_eq!(app.state().search_query, "vatar");
assert_eq!(app.state().search_query.cursor(), 0);
- // End -> cursor at end
let end = KeyEvent::new(KeyCode::End, KeyModifiers::empty());
app.handle_action(Action::Key(end)).await;
assert_eq!(app.state().search_query.cursor(), 5);
@@ -707,7 +701,6 @@ async fn test_ctrl_u_and_clear_command_clears_results_cleanly() {
assert!(app.state().search_query.is_empty());
assert_eq!(app.state().input_mode, InputMode::Normal);
- // Test /clear slash command
app.state_mut().search_results.push(SearchResult {
id: "2".to_string(),
title: "Inception".to_string(),
@@ -833,7 +826,6 @@ async fn test_no_results_and_error_state_rendering_hints() {
let mut terminal = Terminal::new(backend).unwrap();
let mut app = App::new();
- // No results view
app.state_mut().active_screen = Screen::Home;
app.state_mut().input_mode = InputMode::Normal;
app.state_mut().has_search_settled = true;
@@ -850,7 +842,6 @@ async fn test_no_results_and_error_state_rendering_hints() {
assert!(text.contains("No results for “nonexistent_movie_xyz” on MovieBox"));
assert!(text.contains("Try on 4KHDHub"));
assert!(text.contains("Clear Search"));
- // Error view
app.state_mut().search_error =
Some("Failed to connect to MovieBox provider: connection refused by server".to_string());
terminal.draw(|frame| app.draw(frame)).unwrap();