Fix unit tests
Some checks failed
Cargo CI / Build and Test (pull_request) Failing after 2m35s
Cargo CI / Lint (pull_request) Failing after 33s

This commit is contained in:
Wojciech Kozlowski 2024-09-29 09:08:25 +02:00
parent 967c4b4175
commit 9488464b11

View File

@ -350,7 +350,7 @@ mod tests {
let app = browse.increment_selection(Delta::Line);
let app = app.unwrap_browse().fetch_musicbrainz();
assert!(matches!(app, AppState::Match(_)));
assert!(matches!(app, AppState::Fetch(_)));
}
fn lookup_album_expectation(
@ -413,7 +413,7 @@ mod tests {
let app = browse.increment_selection(Delta::Line);
let app = app.unwrap_browse().fetch_musicbrainz();
assert!(matches!(app, AppState::Match(_)));
assert!(matches!(app, AppState::Fetch(_)));
}
fn lookup_artist_expectation(job_sender: &mut MockIMbJobSender, artist: &ArtistMeta) {
@ -542,21 +542,23 @@ mod tests {
}
#[test]
fn recv_err_disconnected_first() {
let (_, rx) = mpsc::channel::<MbApiResult>();
fn recv_err_empty_first() {
let mut collection = COLLECTION.clone();
collection[0].albums.clear();
let inner = inner(music_hoard(COLLECTION.clone()));
let fetch = FetchState::new(rx);
let app = AppMachine::app_fetch_next(inner, fetch);
let app = AppMachine::app_fetch_first(inner(music_hoard(collection)));
assert!(matches!(app, AppState::Match(_)));
}
#[test]
fn recv_err_disconnected_next() {
let (_, rx) = mpsc::channel::<MbApiResult>();
fn recv_err_empty_next() {
let mut collection = COLLECTION.clone();
collection[0].albums.clear();
let (_, rx) = mpsc::channel::<MbApiResult>();
let fetch = FetchState::new(rx);
let app = AppMachine::app_fetch_next(inner(music_hoard(COLLECTION.clone())), fetch);
let app = AppMachine::app_fetch_next(inner(music_hoard(collection)), fetch);
assert!(matches!(app, AppState::Browse(_)));
}