Formatting

This commit is contained in:
Connor Johnstone
2026-03-18 15:35:58 -04:00
parent 37410ce216
commit c6452609d6
8 changed files with 60 additions and 33 deletions

View File

@@ -5,7 +5,9 @@ use shanty_db::entities::wanted_item::{ItemType, WantedStatus};
use shanty_db::{Database, queries};
async fn test_db() -> Database {
Database::new("sqlite::memory:").await.expect("failed to create test database")
Database::new("sqlite::memory:")
.await
.expect("failed to create test database")
}
#[tokio::test]
@@ -163,9 +165,17 @@ async fn test_wanted_items_lifecycle() {
.unwrap();
// Add wanted item
let item = queries::wanted::add(conn, ItemType::Artist, "Radiohead", None, Some(artist.id), None, None)
.await
.unwrap();
let item = queries::wanted::add(
conn,
ItemType::Artist,
"Radiohead",
None,
Some(artist.id),
None,
None,
)
.await
.unwrap();
assert_eq!(item.status, WantedStatus::Wanted);
assert_eq!(item.item_type, ItemType::Artist);
@@ -219,14 +229,9 @@ async fn test_download_queue_lifecycle() {
assert!(next.is_none());
// Fail it
queries::downloads::update_status(
conn,
item.id,
DownloadStatus::Failed,
Some("network error"),
)
.await
.unwrap();
queries::downloads::update_status(conn, item.id, DownloadStatus::Failed, Some("network error"))
.await
.unwrap();
// List failed
let failed = queries::downloads::list(conn, Some(DownloadStatus::Failed))
@@ -236,7 +241,9 @@ async fn test_download_queue_lifecycle() {
assert_eq!(failed[0].error_message.as_deref(), Some("network error"));
// Retry
queries::downloads::retry_failed(conn, item.id).await.unwrap();
queries::downloads::retry_failed(conn, item.id)
.await
.unwrap();
let pending = queries::downloads::list(conn, Some(DownloadStatus::Pending))
.await
.unwrap();
@@ -286,7 +293,9 @@ async fn test_search_cache_ttl() {
.await
.unwrap();
let purged = queries::cache::purge_prefix(conn, "artist_totals:").await.unwrap();
let purged = queries::cache::purge_prefix(conn, "artist_totals:")
.await
.unwrap();
assert_eq!(purged, 2);
// other_key should still exist