fix(api): hoist test helper above statements
This commit is contained in:
@@ -1293,6 +1293,22 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn tracking_a_season_marks_revealed_episodes_and_off_withdraws_nothing() {
|
||||
async fn patch_season(
|
||||
base: &str,
|
||||
series_id: i64,
|
||||
body: serde_json::Value,
|
||||
) -> serde_json::Value {
|
||||
reqwest::Client::new()
|
||||
.patch(format!("{base}/api/series/{series_id}/seasons/1"))
|
||||
.json(&body)
|
||||
.send()
|
||||
.await
|
||||
.expect("update season")
|
||||
.json()
|
||||
.await
|
||||
.expect("season json")
|
||||
}
|
||||
|
||||
let (_dir, state, base) = application().await;
|
||||
let root_id = tv_root(&state, "main").await;
|
||||
let series = add_series(&base, root_id, false).await;
|
||||
@@ -1310,22 +1326,6 @@ mod tests {
|
||||
assert_eq!(season["tracked"], false);
|
||||
assert_eq!(season["episodes"][0]["wanted"], false);
|
||||
|
||||
async fn patch_season(
|
||||
base: &str,
|
||||
series_id: i64,
|
||||
body: serde_json::Value,
|
||||
) -> serde_json::Value {
|
||||
reqwest::Client::new()
|
||||
.patch(format!("{base}/api/series/{series_id}/seasons/1"))
|
||||
.json(&body)
|
||||
.send()
|
||||
.await
|
||||
.expect("update season")
|
||||
.json()
|
||||
.await
|
||||
.expect("season json")
|
||||
}
|
||||
|
||||
let updated = patch_season(&base, series_id, serde_json::json!({"tracked": true})).await;
|
||||
assert_eq!(updated["tracked"], true);
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user