From cb09f47eb25c076687f8b8faf8cc8672994a8ffb Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sun, 15 Sep 2024 11:00:12 +0200 Subject: [PATCH] Ui unit tests --- src/tui/ui/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tui/ui/mod.rs b/src/tui/ui/mod.rs index c45862d..b87ddfa 100644 --- a/src/tui/ui/mod.rs +++ b/src/tui/ui/mod.rs @@ -253,12 +253,14 @@ mod tests { fn artist_matches(matching: ArtistMeta, list: Vec>) -> MatchStateInfo { let mut list: Vec> = list.into_iter().map(Into::into).collect(); list.push(MatchOption::CannotHaveMbid); + list.push(MatchOption::ManualInputMbid); MatchStateInfo::artist(matching, list) } fn album_matches(matching: AlbumMeta, list: Vec>) -> MatchStateInfo { let mut list: Vec> = list.into_iter().map(Into::into).collect(); list.push(MatchOption::CannotHaveMbid); + list.push(MatchOption::ManualInputMbid); MatchStateInfo::album(matching, list) } @@ -380,6 +382,10 @@ mod tests { input: None, }; terminal.draw(|frame| Ui::render(&mut app, frame)).unwrap(); + + let input = tui_input::Input::default(); + app.input = Some(&input); + terminal.draw(|frame| Ui::render(&mut app, frame)).unwrap(); } #[test] @@ -415,5 +421,9 @@ mod tests { input: None, }; terminal.draw(|frame| Ui::render(&mut app, frame)).unwrap(); + + let input = tui_input::Input::default(); + app.input = Some(&input); + terminal.draw(|frame| Ui::render(&mut app, frame)).unwrap(); } }