fix: Modified the Sonarr DownloadRecord so that the episode_id is optional to prevent crashes for weird downloads
This commit is contained in:
@@ -5438,7 +5438,7 @@ mod test {
|
||||
#[test]
|
||||
fn test_get_episode_status_missing() {
|
||||
let download_record = DownloadRecord {
|
||||
episode_id: 1,
|
||||
episode_id: Some(Number::from(1i64)),
|
||||
..DownloadRecord::default()
|
||||
};
|
||||
|
||||
@@ -5450,13 +5450,25 @@ mod test {
|
||||
assert_str_eq!(get_episode_status(false, &[download_record], 1), "Missing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_episode_status_missing_if_episode_id_is_missing() {
|
||||
let download_record = DownloadRecord::default();
|
||||
|
||||
assert_str_eq!(
|
||||
get_episode_status(false, &[download_record.clone()], 0),
|
||||
"Missing"
|
||||
);
|
||||
|
||||
assert_str_eq!(get_episode_status(false, &[download_record], 1), "Missing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_episode_status_downloading() {
|
||||
assert_str_eq!(
|
||||
get_episode_status(
|
||||
false,
|
||||
&[DownloadRecord {
|
||||
episode_id: 1,
|
||||
episode_id: Some(Number::from(1i64)),
|
||||
status: DownloadStatus::Downloading,
|
||||
..DownloadRecord::default()
|
||||
}],
|
||||
@@ -5472,7 +5484,7 @@ mod test {
|
||||
get_episode_status(
|
||||
false,
|
||||
&[DownloadRecord {
|
||||
episode_id: 1,
|
||||
episode_id: Some(Number::from(1i64)),
|
||||
status: DownloadStatus::Completed,
|
||||
..DownloadRecord::default()
|
||||
}],
|
||||
@@ -5523,7 +5535,7 @@ mod test {
|
||||
title: "Test Download Title".to_owned(),
|
||||
status: DownloadStatus::Downloading,
|
||||
id: 1,
|
||||
episode_id: 1,
|
||||
episode_id: Some(Number::from(1i64)),
|
||||
size: 3543348019f64,
|
||||
sizeleft: 1771674009f64,
|
||||
output_path: Some(HorizontallyScrollableText::from(
|
||||
|
||||
Reference in New Issue
Block a user