Fix unit tests

This commit is contained in:
Wojciech Kozlowski 2024-09-14 23:18:09 +02:00
parent 48e19c1f7f
commit 18bbf78a92

View File

@ -273,6 +273,7 @@ mod tests {
match_state(Some(album_match.clone())),
);
album_match.push_cannot_have_mbid();
album_match.push_manual_input_mbid();
let mut widget_state = WidgetState::default();
widget_state.list.select(Some(0));
@ -296,6 +297,7 @@ mod tests {
let matches = AppMachine::match_state(inner(music_hoard(vec![])), app_matches);
matches_info.push_cannot_have_mbid();
matches_info.push_manual_input_mbid();
let mut widget_state = WidgetState::default();
widget_state.list.select(Some(0));
@ -319,12 +321,19 @@ mod tests {
assert_eq!(matches.state.current.as_ref(), Some(&matches_info));
assert_eq!(matches.state.state.list.selected(), Some(2));
// Next is ManualInputMbid
let matches = matches.next_match().unwrap_match();
assert_eq!(matches.state.current.as_ref(), Some(&matches_info));
assert_eq!(matches.state.state.list.selected(), Some(2));
assert_eq!(matches.state.state.list.selected(), Some(3));
// And it's done
let matches = matches.next_match().unwrap_match();
assert_eq!(matches.state.current.as_ref(), Some(&matches_info));
assert_eq!(matches.state.state.list.selected(), Some(3));
// Go prev_match first as selecting on manual input does not go back to fetch.
let matches = matches.prev_match().unwrap_match();
matches.select().unwrap_fetch();
}
@ -346,6 +355,7 @@ mod tests {
match_state(Some(album_match.clone())),
);
album_match.push_cannot_have_mbid();
album_match.push_manual_input_mbid();
let mut widget_state = WidgetState::default();
widget_state.list.select(Some(0));