feat(web): mirror tv results in search client

This commit is contained in:
Miguel Palhas
2026-08-23 17:37:09 +01:00
parent 9f8d58fd58
commit 58f2f8361a
3 changed files with 130 additions and 20 deletions
+18 -11
View File
@@ -804,7 +804,9 @@ mod tests {
.await;
Mock::given(method("GET"))
.and(path("/search/tv"))
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})))
.respond_with(
ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})),
)
.mount(&tmdb)
.await;
let (_dir, state, base) = application(&tmdb, &prowlarr).await;
@@ -833,14 +835,16 @@ mod tests {
let prowlarr = MockServer::start().await;
Mock::given(method("GET"))
.and(path("/search/movie"))
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})))
.respond_with(
ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})),
)
.mount(&tmdb)
.await;
Mock::given(method("GET"))
.and(path("/search/tv"))
.respond_with(
ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[{
"id": 827_28, "name": "Bluey", "original_language": "en",
"id": 82_728, "name": "Bluey", "original_language": "en",
"first_air_date": "2018-10-01"
}]})),
)
@@ -861,12 +865,13 @@ mod tests {
.fetch_one(pool)
.await
.expect("series");
let season_id: i64 =
sqlx::query_scalar("INSERT INTO seasons (series_id, number) VALUES (?, 1) RETURNING id")
.bind(series_id)
.fetch_one(pool)
.await
.expect("season");
let season_id: i64 = sqlx::query_scalar(
"INSERT INTO seasons (series_id, number) VALUES (?, 1) RETURNING id",
)
.bind(series_id)
.fetch_one(pool)
.await
.expect("season");
sqlx::query("INSERT INTO episodes (season_id, number, title) VALUES (?, 2, 'Hospital')")
.bind(season_id)
.execute(pool)
@@ -898,7 +903,7 @@ mod tests {
.expect("json");
assert_eq!(response["library"][0]["kind"], "series");
assert_eq!(response["library"][0]["title"], "Bluey");
assert_eq!(response["library"][0]["tmdb_id"], 827_28);
assert_eq!(response["library"][0]["tmdb_id"], 82_728);
}
#[tokio::test]
@@ -926,7 +931,9 @@ mod tests {
.await;
Mock::given(method("GET"))
.and(path("/search/tv"))
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})))
.respond_with(
ResponseTemplate::new(200).set_body_json(serde_json::json!({"results":[]})),
)
.mount(&tmdb)
.await;
let (_dir, state, base) = application(&tmdb, &prowlarr).await;