async cleanup

This commit is contained in:
Antoine Gersant 2024-08-10 10:31:53 -07:00
parent 0afab8d634
commit 39407c6551
2 changed files with 26 additions and 26 deletions

View file

@ -205,8 +205,8 @@ mod test {
(browser, strings) (browser, strings)
} }
#[tokio::test] #[test]
async fn can_browse_top_level() { fn can_browse_top_level() {
let song_a = PathBuf::from_iter(["Music", "Iron Maiden", "Moonchild.mp3"]); let song_a = PathBuf::from_iter(["Music", "Iron Maiden", "Moonchild.mp3"]);
let (browser, strings) = setup_test(HashSet::from([song_a])); let (browser, strings) = setup_test(HashSet::from([song_a]));
let files = browser.browse(&strings, PathBuf::new()).unwrap(); let files = browser.browse(&strings, PathBuf::new()).unwrap();
@ -214,8 +214,8 @@ mod test {
assert_eq!(files[0], File::Directory(PathBuf::from_iter(["Music"]))); assert_eq!(files[0], File::Directory(PathBuf::from_iter(["Music"])));
} }
#[tokio::test] #[test]
async fn can_browse_directory() { fn can_browse_directory() {
let artist_directory = PathBuf::from_iter(["Music", "Iron Maiden"]); let artist_directory = PathBuf::from_iter(["Music", "Iron Maiden"]);
let (browser, strings) = setup_test(HashSet::from([ let (browser, strings) = setup_test(HashSet::from([
@ -234,8 +234,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn can_flatten_root() { fn can_flatten_root() {
let song_a = PathBuf::from_iter(["Music", "Electronic", "Papua New Guinea.mp3"]); let song_a = PathBuf::from_iter(["Music", "Electronic", "Papua New Guinea.mp3"]);
let song_b = PathBuf::from_iter(["Music", "Metal", "Destiny.mp3"]); let song_b = PathBuf::from_iter(["Music", "Metal", "Destiny.mp3"]);
let song_c = PathBuf::from_iter(["Music", "Metal", "No Turning Back.mp3"]); let song_c = PathBuf::from_iter(["Music", "Metal", "No Turning Back.mp3"]);
@ -251,8 +251,8 @@ mod test {
assert_eq!(files, [song_a, song_b, song_c]); assert_eq!(files, [song_a, song_b, song_c]);
} }
#[tokio::test] #[test]
async fn can_flatten_directory() { fn can_flatten_directory() {
let electronic = PathBuf::from_iter(["Music", "Electronic"]); let electronic = PathBuf::from_iter(["Music", "Electronic"]);
let song_a = electronic.join(PathBuf::from_iter(["FSOL", "Papua New Guinea.mp3"])); let song_a = electronic.join(PathBuf::from_iter(["FSOL", "Papua New Guinea.mp3"]));
let song_b = electronic.join(PathBuf::from_iter(["Kraftwerk", "Autobahn.mp3"])); let song_b = electronic.join(PathBuf::from_iter(["Kraftwerk", "Autobahn.mp3"]));
@ -269,8 +269,8 @@ mod test {
assert_eq!(files, [song_a, song_b]); assert_eq!(files, [song_a, song_b]);
} }
#[tokio::test] #[test]
async fn can_flatten_directory_with_shared_prefix() { fn can_flatten_directory_with_shared_prefix() {
let directory_a = PathBuf::from_iter(["Music", "Therion", "Leviathan II"]); let directory_a = PathBuf::from_iter(["Music", "Therion", "Leviathan II"]);
let directory_b = PathBuf::from_iter(["Music", "Therion", "Leviathan III"]); let directory_b = PathBuf::from_iter(["Music", "Therion", "Leviathan III"]);
let song_a = directory_a.join("Pazuzu.mp3"); let song_a = directory_a.join("Pazuzu.mp3");

View file

@ -303,8 +303,8 @@ mod test {
(browser, strings) (browser, strings)
} }
#[tokio::test] #[test]
async fn can_list_artists() { fn can_list_artists() {
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
virtual_path: PathBuf::from("Kai.mp3"), virtual_path: PathBuf::from("Kai.mp3"),
@ -329,8 +329,8 @@ mod test {
assert_eq!(artists, vec!["FSOL".to_owned(), "Stratovarius".to_owned()]); assert_eq!(artists, vec!["FSOL".to_owned(), "Stratovarius".to_owned()]);
} }
#[tokio::test] #[test]
async fn artist_list_is_sorted() { fn artist_list_is_sorted() {
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
virtual_path: PathBuf::from("Destiny.mp3"), virtual_path: PathBuf::from("Destiny.mp3"),
@ -358,8 +358,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn can_get_random_albums() { fn can_get_random_albums() {
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
album: Some("ISDN".to_owned()), album: Some("ISDN".to_owned()),
@ -383,8 +383,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn can_get_recent_albums() { fn can_get_recent_albums() {
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
album: Some("ISDN".to_owned()), album: Some("ISDN".to_owned()),
@ -410,8 +410,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn albums_are_associated_with_artists() { fn albums_are_associated_with_artists() {
let artist_name = "Bestest Artist"; let artist_name = "Bestest Artist";
let other_artist_name = "Cool Kidz"; let other_artist_name = "Cool Kidz";
let album_name = "Bestest Album"; let album_name = "Bestest Album";
@ -517,8 +517,8 @@ mod test {
} }
} }
#[tokio::test] #[test]
async fn albums_are_sorted_by_year() { fn albums_are_sorted_by_year() {
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
virtual_path: PathBuf::from("Rebel.mp3"), virtual_path: PathBuf::from("Rebel.mp3"),
@ -570,8 +570,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn album_songs_are_sorted() { fn album_songs_are_sorted() {
let album_path = PathBuf::from_iter(["FSOL", "Lifeforms"]); let album_path = PathBuf::from_iter(["FSOL", "Lifeforms"]);
let (collection, strings) = setup_test(Vec::from([ let (collection, strings) = setup_test(Vec::from([
scanner::Song { scanner::Song {
@ -634,8 +634,8 @@ mod test {
); );
} }
#[tokio::test] #[test]
async fn can_get_a_song() { fn can_get_a_song() {
let song_path = PathBuf::from_iter(["FSOL", "ISDN", "Kai.mp3"]); let song_path = PathBuf::from_iter(["FSOL", "ISDN", "Kai.mp3"]);
let (collection, strings) = setup_test(Vec::from([scanner::Song { let (collection, strings) = setup_test(Vec::from([scanner::Song {
virtual_path: song_path.clone(), virtual_path: song_path.clone(),