Add optional imdb_id

This commit is contained in:
Marc Plano-Lesay 2025-05-01 20:53:37 +10:00
parent 90c3fc5ee3
commit df6e3476cc
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
7 changed files with 14 additions and 0 deletions

View file

@ -99,6 +99,7 @@ impl Database {
subreddit: post.subreddit.as_str(),
link: m,
published_at: &published_at,
imdb_id: post.imdb_id.as_deref(),
})
.collect::<Vec<NewMagnet>>();
@ -167,6 +168,7 @@ mod tests {
"magnet:?xt=urn:btih:test2".to_string(),
],
timestamp: Utc::now(),
imdb_id: None,
};
let expected_timestamp = post_info.timestamp.naive_utc();
@ -205,6 +207,7 @@ mod tests {
"magnet:?xt=urn:btih:test2".to_string(),
],
timestamp: Utc::now(),
imdb_id: None,
};
// First insertion should succeed and insert 2 links
@ -222,6 +225,7 @@ mod tests {
"magnet:?xt=urn:btih:test3".to_string(), // New
],
timestamp: Utc::now(),
imdb_id: Some("tt1234567".to_string()),
};
// Second insertion should succeed but only insert the new link
@ -243,6 +247,7 @@ mod tests {
"magnet:?xt=urn:btih:test2".to_string(), // Duplicate
],
timestamp: Utc::now(),
imdb_id: None,
};
// Third insertion should succeed but insert 0 links