feat: CLI and TUI support for track history and track details in Lidarr
This commit is contained in:
@@ -13,12 +13,11 @@ mod tests {
|
||||
ArtistDetailsHandler, releases_sorting_options,
|
||||
};
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::lidarr_models::{Album, LidarrHistoryItem, LidarrRelease};
|
||||
use crate::models::lidarr_models::{LidarrHistoryItem, LidarrRelease};
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::{
|
||||
ALBUM_DETAILS_BLOCKS, ARTIST_DETAILS_BLOCKS, ActiveLidarrBlock, DELETE_ALBUM_BLOCKS,
|
||||
ARTIST_DETAILS_BLOCKS, ActiveLidarrBlock,
|
||||
};
|
||||
use crate::models::servarr_models::{Quality, QualityWrapper};
|
||||
use crate::test_handler_delegation;
|
||||
|
||||
mod test_handle_delete {
|
||||
use super::*;
|
||||
@@ -812,12 +811,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_artist_details_handler_accepts() {
|
||||
let mut artist_details_blocks = ARTIST_DETAILS_BLOCKS.clone().to_vec();
|
||||
artist_details_blocks.extend(DELETE_ALBUM_BLOCKS);
|
||||
artist_details_blocks.extend(ALBUM_DETAILS_BLOCKS);
|
||||
|
||||
ActiveLidarrBlock::iter().for_each(|active_lidarr_block| {
|
||||
if artist_details_blocks.contains(&active_lidarr_block) {
|
||||
if ARTIST_DETAILS_BLOCKS.contains(&active_lidarr_block) {
|
||||
assert!(ArtistDetailsHandler::accepts(active_lidarr_block));
|
||||
} else {
|
||||
assert!(!ArtistDetailsHandler::accepts(active_lidarr_block));
|
||||
@@ -977,58 +972,6 @@ mod tests {
|
||||
assert!(handler.is_ready());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_delegates_delete_album_blocks_to_delete_album_handler() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.lidarr_data
|
||||
.albums
|
||||
.set_items(vec![Album::default()]);
|
||||
app.push_navigation_stack(ActiveLidarrBlock::ArtistDetails.into());
|
||||
app.push_navigation_stack(ActiveLidarrBlock::DeleteAlbumPrompt.into());
|
||||
|
||||
ArtistDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveLidarrBlock::DeleteAlbumPrompt,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
ActiveLidarrBlock::ArtistDetails.into()
|
||||
);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn test_delegates_album_details_blocks_to_album_details_handler(
|
||||
#[values(
|
||||
ActiveLidarrBlock::AlbumDetails,
|
||||
ActiveLidarrBlock::AlbumHistory,
|
||||
ActiveLidarrBlock::SearchTracks,
|
||||
ActiveLidarrBlock::SearchTracksError,
|
||||
ActiveLidarrBlock::AutomaticallySearchAlbumPrompt,
|
||||
ActiveLidarrBlock::SearchAlbumHistory,
|
||||
ActiveLidarrBlock::SearchAlbumHistoryError,
|
||||
ActiveLidarrBlock::FilterAlbumHistory,
|
||||
ActiveLidarrBlock::FilterAlbumHistoryError,
|
||||
ActiveLidarrBlock::AlbumHistorySortPrompt,
|
||||
ActiveLidarrBlock::AlbumHistoryDetails,
|
||||
ActiveLidarrBlock::ManualAlbumSearch,
|
||||
ActiveLidarrBlock::ManualAlbumSearchSortPrompt,
|
||||
ActiveLidarrBlock::DeleteTrackFilePrompt
|
||||
)]
|
||||
active_sonarr_block: ActiveLidarrBlock,
|
||||
) {
|
||||
test_handler_delegation!(
|
||||
ArtistDetailsHandler,
|
||||
ActiveLidarrBlock::Artists,
|
||||
active_sonarr_block
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_releases_sorting_options_source() {
|
||||
let expected_cmp_fn: fn(&LidarrRelease, &LidarrRelease) -> Ordering =
|
||||
|
||||
Reference in New Issue
Block a user