Provide a keyboard shortcut to pull all release groups of an artist #233

Merged
wojtek merged 14 commits from 160---provide-a-keyboard-shortcut-to-pull-all-release-groups-of-an-artist into main 2024-12-30 23:42:20 +01:00
Showing only changes of commit 62918ff3ca - Show all commits

View File

@ -729,20 +729,23 @@ mod tests {
assert!(matches!(app, AppState::Fetch(_)));
}
#[test]
fn recv_err_empty_first() {
let mut collection = COLLECTION.clone();
collection[0].albums.clear();
let requests = AppMachine::browse_release_group_job(&collection[0].meta.info.musicbrainz);
fn browse_release_group_expectation(artist: &Artist) -> MockIMbJobSender {
let requests = AppMachine::browse_release_group_job(&artist.meta.info.musicbrainz);
let mut mb_job_sender = MockIMbJobSender::new();
mb_job_sender
.expect_submit_background_job()
.with(predicate::always(), predicate::eq(requests))
.times(1)
.return_once(|_, _| Ok(()));
mb_job_sender
}
#[test]
fn recv_err_empty_first() {
let mut collection = COLLECTION.clone();
collection[0].albums.clear();
let mb_job_sender = browse_release_group_expectation(&collection[0]);
let inner = inner_with_mb(music_hoard(collection), mb_job_sender);
let app = AppMachine::app_fetch_first(inner);
assert!(matches!(app, AppState::Fetch(_)));
@ -760,6 +763,20 @@ mod tests {
assert!(matches!(app, AppState::Fetch(_)));
}
#[test]
fn recv_err_disconnected_next() {
let mut collection = COLLECTION.clone();
collection[0].albums.clear();
let (_, rx) = mpsc::channel::<MbApiResult>();
let fetch = FetchState::search(rx);
let mb_job_sender = browse_release_group_expectation(&collection[0]);
let inner = inner_with_mb(music_hoard(collection), mb_job_sender);
let app = AppMachine::app_fetch_next(inner, fetch);
assert!(matches!(app, AppState::Fetch(_)));
}
#[test]
fn empty_first_then_ready() {
let (tx, rx) = mpsc::channel::<MbApiResult>();