Skip to content

Commit

Permalink
test: add test for get album list2
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia committed Apr 10, 2024
1 parent d6b7b60 commit a882af8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/open_subsonic/media_list/get_album_list2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,34 @@ pub async fn get_album_list2_handler(
.into(),
))
}

#[cfg(test)]
mod tests {
use strum::IntoEnumIterator;

use super::*;
use crate::utils::test::Infra;

#[tokio::test]
async fn test_get_album() {
let mut infra = Infra::new().await.n_folder(1).await.add_user(None).await;
infra.add_n_song(0, 20).scan(.., None).await;
for list_type in GetAlbumListType::iter() {
get_album_list2(
infra.pool(),
infra.user_id(0),
GetAlbumList2Params {
list_type,
count: None,
offset: None,
music_folder_ids: None,
from_year: Some(1000),
to_year: Some(2000),
genre: Some("genre".into()),
},
)
.await
.unwrap();
}
}
}
3 changes: 2 additions & 1 deletion types/src/media_list/get_album_list2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use nghe_proc_macros::{add_common_convert, add_subsonic_response, add_types_derive};
use strum::EnumIter;
use uuid::Uuid;

use crate::id3::*;

#[add_types_derive]
#[derive(Debug)]
#[derive(Debug, EnumIter)]
pub enum GetAlbumListType {
Random,
Newest,
Expand Down

0 comments on commit a882af8

Please sign in to comment.