test(arr): a forced candidate writes no sidecar
Ranking already rejects one (#185); this holds the loop to it at the end of the pipeline, where the row would appear.
This commit is contained in:
@@ -1494,6 +1494,45 @@ mod tests {
|
|||||||
.contains("no text source to translate from"));
|
.contains("no text source to translate from"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// §15 gives a language exactly one sidecar and forced gets no segment
|
||||||
|
/// of its own, so nothing in the loop may ever write one. Ranking already
|
||||||
|
/// rejects a forced candidate (#185); this holds it to that at the end of
|
||||||
|
/// the pipeline, where the row would actually appear (#222).
|
||||||
|
#[tokio::test]
|
||||||
|
async fn a_forced_candidate_never_becomes_a_sidecar() {
|
||||||
|
let fixture = Fixture::new(&no_tracks()).await;
|
||||||
|
fixture.configure(r#"["pt-PT"]"#, Some("openai")).await;
|
||||||
|
let forced = Candidate {
|
||||||
|
forced: true,
|
||||||
|
hash_match: true,
|
||||||
|
download_count: Some(1_000_000),
|
||||||
|
..candidate("opensubtitles", "forced", Language::PortuguesePortugal)
|
||||||
|
};
|
||||||
|
let action = action(
|
||||||
|
vec![Arc::new(StubProvider::new("opensubtitles", vec![forced]))],
|
||||||
|
vec![Arc::new(StubBackend)],
|
||||||
|
);
|
||||||
|
|
||||||
|
action.run(&fixture.database).await.unwrap();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
fixture.files().await.is_empty(),
|
||||||
|
"a forced candidate is not a subtitle arr has"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!fixture
|
||||||
|
.directory
|
||||||
|
.path()
|
||||||
|
.join("Movie (2024) - [1080p].pt-PT.srt")
|
||||||
|
.exists(),
|
||||||
|
"and nothing was written for it"
|
||||||
|
);
|
||||||
|
// The best candidate on offer being unusable is the same position as
|
||||||
|
// no candidate at all: nothing to fetch and nothing to translate from.
|
||||||
|
let attempt = fixture.attempt("pt-PT").await.unwrap();
|
||||||
|
assert_eq!(attempt.state, SubtitleState::Unavailable);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn the_ranked_winner_is_fetched_synced_and_recorded() {
|
async fn the_ranked_winner_is_fetched_synced_and_recorded() {
|
||||||
let fixture = Fixture::new(&no_tracks()).await;
|
let fixture = Fixture::new(&no_tracks()).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user