test: satisfy clippy assert_is_empty
Stable 1.99 added the lint and CI denies warnings, which failed the build and skipped the deploy. Each flagged assert now uses the assert_eq! form clippy suggests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1b6dae676a
commit
ee7f05bf22
@@ -319,7 +319,7 @@ mod tests {
|
||||
.json()
|
||||
.await
|
||||
.expect("alice json");
|
||||
assert!(alice_view.is_empty());
|
||||
assert_eq!(alice_view, [] as [serde_json::Value; 0]);
|
||||
|
||||
let bob_view: Vec<serde_json::Value> =
|
||||
reqwest::get(format!("{base}/api/movies?owner_id={bob_id}"))
|
||||
|
||||
@@ -946,7 +946,7 @@ mod tests {
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
assert_eq!(stored_path(&base, 1).await, new.to_str().expect("utf-8"));
|
||||
assert!(!new.exists(), "nothing was created on disk");
|
||||
assert!(file_paths(&state).await.is_empty());
|
||||
assert_eq!(file_paths(&state).await, [] as [std::string::String; 0]);
|
||||
}
|
||||
|
||||
/// Issue #236: a destination already holding a folder of that name is a
|
||||
|
||||
@@ -1224,7 +1224,10 @@ mod tests {
|
||||
let body: serde_json::Value = response.json().await.expect("json");
|
||||
assert_eq!(body["library"][0]["kind"], "movie");
|
||||
assert_eq!(body["library"][0]["title"], "Dune");
|
||||
assert!(body["tmdb"].as_array().expect("tmdb").is_empty());
|
||||
assert_eq!(
|
||||
body["tmdb"].as_array().expect("tmdb").as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
assert_eq!(body["tmdb_status"], "unavailable");
|
||||
drop(dir);
|
||||
}
|
||||
|
||||
@@ -3517,7 +3517,7 @@ mod tests {
|
||||
.json()
|
||||
.await
|
||||
.expect("json");
|
||||
assert!(empty.is_empty());
|
||||
assert_eq!(empty, [] as [serde_json::Value; 0]);
|
||||
|
||||
let tagged = reqwest::Client::new()
|
||||
.put(format!("{base}/api/series/{series_id}/owners/{owner_id}"))
|
||||
@@ -3557,7 +3557,7 @@ mod tests {
|
||||
.json()
|
||||
.await
|
||||
.expect("json");
|
||||
assert!(owners.is_empty());
|
||||
assert_eq!(owners, [] as [serde_json::Value; 0]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -2225,10 +2225,13 @@ mod tests {
|
||||
// No grab record backs this file, so nothing can claim its release
|
||||
// name — the chip reads "no", never "unknown".
|
||||
assert_eq!(candidates[0]["release_match"], false);
|
||||
assert!(body["provider_errors"]
|
||||
.as_array()
|
||||
.expect("errors")
|
||||
.is_empty());
|
||||
assert_eq!(
|
||||
body["provider_errors"]
|
||||
.as_array()
|
||||
.expect("errors")
|
||||
.as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
}
|
||||
|
||||
/// One provider failing is not the search failing: §15 configures two.
|
||||
@@ -2574,7 +2577,10 @@ mod tests {
|
||||
let (status, body) = grab(&fixture, pt()).await;
|
||||
|
||||
assert_eq!(status, StatusCode::SERVICE_UNAVAILABLE, "{body}");
|
||||
assert!(fixture.subtitle_rows().await.is_empty());
|
||||
assert_eq!(
|
||||
fixture.subtitle_rows().await,
|
||||
[] as [arr_db::SubtitleFile; 0]
|
||||
);
|
||||
assert!(!fixture
|
||||
.folder
|
||||
.join("Dune (2021) [tmdbid-438631] - [2160p][WEB-DL].pt-PT.srt")
|
||||
@@ -2600,7 +2606,10 @@ mod tests {
|
||||
|
||||
assert_eq!(status, StatusCode::NOT_FOUND, "{body}");
|
||||
assert_eq!(body["code"], "candidate_expired");
|
||||
assert!(fixture.subtitle_rows().await.is_empty());
|
||||
assert_eq!(
|
||||
fixture.subtitle_rows().await,
|
||||
[] as [arr_db::SubtitleFile; 0]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -2822,7 +2831,10 @@ mod tests {
|
||||
.expect("delete");
|
||||
assert_eq!(response.status(), StatusCode::NO_CONTENT);
|
||||
assert!(!path.exists(), "the sidecar is gone from disk");
|
||||
assert!(fixture.subtitle_rows().await.is_empty());
|
||||
assert_eq!(
|
||||
fixture.subtitle_rows().await,
|
||||
[] as [arr_db::SubtitleFile; 0]
|
||||
);
|
||||
assert_eq!(
|
||||
fixture.attempt_state("pt-PT").await.as_deref(),
|
||||
Some("wanted")
|
||||
@@ -2923,10 +2935,13 @@ mod tests {
|
||||
let statuses = status(&format!("{}/api/movies/1/subtitles/status", fixture.base)).await;
|
||||
assert_eq!(statuses.len(), 1);
|
||||
assert_eq!(statuses[0]["media_file_id"], 1);
|
||||
assert!(statuses[0]["subtitles"]
|
||||
.as_array()
|
||||
.expect("subtitles")
|
||||
.is_empty());
|
||||
assert_eq!(
|
||||
statuses[0]["subtitles"]
|
||||
.as_array()
|
||||
.expect("subtitles")
|
||||
.as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
let missing = statuses[0]["missing"].as_array().expect("missing");
|
||||
assert_eq!(missing.len(), 2, "{missing:?}");
|
||||
assert_eq!(missing[0]["language"], "pt-PT");
|
||||
@@ -3108,10 +3123,13 @@ mod tests {
|
||||
fixture.probe(serde_json::json!(["en", "pt-PT"])).await;
|
||||
|
||||
let statuses = status(&format!("{}/api/movies/1/subtitles/status", fixture.base)).await;
|
||||
assert!(statuses[0]["embedded_tracks"]
|
||||
.as_array()
|
||||
.expect("embedded_tracks")
|
||||
.is_empty());
|
||||
assert_eq!(
|
||||
statuses[0]["embedded_tracks"]
|
||||
.as_array()
|
||||
.expect("embedded_tracks")
|
||||
.as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
}
|
||||
|
||||
/// The issue's whole point: nothing is missing on this file, so the
|
||||
@@ -3223,7 +3241,10 @@ mod tests {
|
||||
|
||||
let (status, body) = extract(&fixture, 0).await;
|
||||
assert_eq!(status, StatusCode::UNPROCESSABLE_ENTITY, "{body}");
|
||||
assert!(fixture.subtitle_rows().await.is_empty());
|
||||
assert_eq!(
|
||||
fixture.subtitle_rows().await,
|
||||
[] as [arr_db::SubtitleFile; 0]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -3268,8 +3289,14 @@ mod tests {
|
||||
async fn subtitle_queue_omits_titles_with_no_gaps() {
|
||||
let fixture = stub_application().await;
|
||||
let body = queue(&fixture.base).await;
|
||||
assert!(body["movies"].as_array().expect("movies").is_empty());
|
||||
assert!(body["series"].as_array().expect("series").is_empty());
|
||||
assert_eq!(
|
||||
body["movies"].as_array().expect("movies").as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
assert_eq!(
|
||||
body["series"].as_array().expect("series").as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
}
|
||||
|
||||
/// #202: an attempt row for a language no longer in the wanted set is
|
||||
@@ -3292,7 +3319,10 @@ mod tests {
|
||||
.expect("narrow wanted set");
|
||||
|
||||
let body = queue(&fixture.base).await;
|
||||
assert!(body["movies"].as_array().expect("movies").is_empty());
|
||||
assert_eq!(
|
||||
body["movies"].as_array().expect("movies").as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
}
|
||||
|
||||
/// #202: a movie's failed attempt surfaces with its language and detail.
|
||||
@@ -3418,10 +3448,13 @@ mod tests {
|
||||
let body = queue(&fixture.base).await;
|
||||
let series = body["series"].as_array().expect("series");
|
||||
assert_eq!(series.len(), 1, "{series:?}");
|
||||
assert!(series[0]["episodes"]
|
||||
.as_array()
|
||||
.expect("episodes")
|
||||
.is_empty());
|
||||
assert_eq!(
|
||||
series[0]["episodes"]
|
||||
.as_array()
|
||||
.expect("episodes")
|
||||
.as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
let seasons = series[0]["seasons"].as_array().expect("seasons");
|
||||
assert_eq!(seasons.len(), 1, "{seasons:?}");
|
||||
assert_eq!(seasons[0]["season_number"], 1);
|
||||
@@ -3475,7 +3508,10 @@ mod tests {
|
||||
let body = queue(&fixture.base).await;
|
||||
let series = body["series"].as_array().expect("series");
|
||||
assert_eq!(series.len(), 1, "{series:?}");
|
||||
assert!(series[0]["seasons"].as_array().expect("seasons").is_empty());
|
||||
assert_eq!(
|
||||
series[0]["seasons"].as_array().expect("seasons").as_slice(),
|
||||
[] as [serde_json::Value; 0]
|
||||
);
|
||||
let episodes = series[0]["episodes"].as_array().expect("episodes");
|
||||
assert_eq!(episodes.len(), 2, "{episodes:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user