Fixed rustfmt issues

This commit is contained in:
2024-10-30 15:43:53 -06:00
parent ce45d9d803
commit 946d02102c
4 changed files with 45 additions and 27 deletions
+7 -3
View File
@@ -65,7 +65,7 @@ pub enum RadarrAddCommand {
monitor: Monitor, monitor: Monitor,
#[arg( #[arg(
long, long,
help = "Tell Radarr to not start a search for this film once it's added to your library", help = "Tell Radarr to not start a search for this film once it's added to your library"
)] )]
no_search_for_movie: bool, no_search_for_movie: bool,
}, },
@@ -77,7 +77,7 @@ pub enum RadarrAddCommand {
#[command(about = "Add new tag")] #[command(about = "Add new tag")]
Tag { Tag {
#[arg(long, help = "The name of the tag to be added", required = true)] #[arg(long, help = "The name of the tag to be added", required = true)]
name: String name: String,
}, },
} }
@@ -94,7 +94,11 @@ pub(super) struct RadarrAddCommandHandler<'a, 'b> {
} }
impl<'a, 'b> CliCommandHandler<'a, 'b, RadarrAddCommand> for RadarrAddCommandHandler<'a, 'b> { impl<'a, 'b> CliCommandHandler<'a, 'b, RadarrAddCommand> for RadarrAddCommandHandler<'a, 'b> {
fn with(_app: &'a Arc<Mutex<App<'b>>>, command: RadarrAddCommand, network: &'a mut dyn NetworkTrait) -> Self { fn with(
_app: &'a Arc<Mutex<App<'b>>>,
command: RadarrAddCommand,
network: &'a mut dyn NetworkTrait,
) -> Self {
RadarrAddCommandHandler { RadarrAddCommandHandler {
_app, _app,
command, command,
@@ -7,9 +7,11 @@ mod tests {
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, MOVIE_DETAILS_BLOCKS}; use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, MOVIE_DETAILS_BLOCKS};
use crate::ui::radarr_ui::library::movie_details_ui::{decorate_peer_style, MovieDetailsUi, style_from_download_status}; use crate::ui::radarr_ui::library::movie_details_ui::{
use crate::ui::DrawUi; decorate_peer_style, style_from_download_status, MovieDetailsUi,
};
use crate::ui::styles::ManagarrStyle; use crate::ui::styles::ManagarrStyle;
use crate::ui::DrawUi;
#[test] #[test]
fn test_movie_details_ui_accepts() { fn test_movie_details_ui_accepts() {
@@ -36,7 +38,10 @@ mod tests {
#[case] movie_status: &str, #[case] movie_status: &str,
#[case] expected_style: Style, #[case] expected_style: Style,
) { ) {
assert_eq!(style_from_download_status(download_status, is_monitored, movie_status.to_owned()), expected_style); assert_eq!(
style_from_download_status(download_status, is_monitored, movie_status.to_owned()),
expected_style
);
} }
#[rstest] #[rstest]
@@ -50,9 +55,18 @@ mod tests {
) { ) {
let text = Text::from("test"); let text = Text::from("test");
match expected_style { match expected_style {
PeerStyle::Failure => assert_eq!(decorate_peer_style(seeders, leechers, text.clone()), text.failure()), PeerStyle::Failure => assert_eq!(
PeerStyle::Warning => assert_eq!(decorate_peer_style(seeders, leechers, text.clone()), text.warning()), decorate_peer_style(seeders, leechers, text.clone()),
PeerStyle::Success => assert_eq!(decorate_peer_style(seeders, leechers, text.clone()), text.success()), text.failure()
),
PeerStyle::Warning => assert_eq!(
decorate_peer_style(seeders, leechers, text.clone()),
text.warning()
),
PeerStyle::Success => assert_eq!(
decorate_peer_style(seeders, leechers, text.clone()),
text.success()
),
} }
} }
+2 -2
View File
@@ -1,15 +1,15 @@
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::models::radarr_models::{DownloadRecord, Movie};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use ratatui::widgets::{Cell, Row}; use ratatui::widgets::{Cell, Row};
use rstest::rstest; use rstest::rstest;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use crate::models::radarr_models::{DownloadRecord, Movie};
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock; use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
use crate::ui::radarr_ui::{decorate_with_row_style, RadarrUi}; use crate::ui::radarr_ui::{decorate_with_row_style, RadarrUi};
use crate::ui::DrawUi;
use crate::ui::styles::ManagarrStyle; use crate::ui::styles::ManagarrStyle;
use crate::ui::DrawUi;
#[test] #[test]
fn test_radarr_ui_accepts() { fn test_radarr_ui_accepts() {