Fix unit tests
This commit is contained in:
parent
69d941f1c5
commit
f4f0da45fe
@ -370,7 +370,7 @@ mod tests {
|
|||||||
|
|
||||||
use crate::tui::{
|
use crate::tui::{
|
||||||
app::{
|
app::{
|
||||||
machine::tests::{inner, music_hoard},
|
machine::tests::{inner, inner_with_mb, music_hoard},
|
||||||
Delta, EntityMatches, IApp, IAppAccess, IAppInteractBrowse, MatchOption,
|
Delta, EntityMatches, IApp, IAppAccess, IAppInteractBrowse, MatchOption,
|
||||||
},
|
},
|
||||||
lib::interface::musicbrainz::{self, api::Entity, daemon::MockIMbJobSender},
|
lib::interface::musicbrainz::{self, api::Entity, daemon::MockIMbJobSender},
|
||||||
@ -734,8 +734,18 @@ mod tests {
|
|||||||
let mut collection = COLLECTION.clone();
|
let mut collection = COLLECTION.clone();
|
||||||
collection[0].albums.clear();
|
collection[0].albums.clear();
|
||||||
|
|
||||||
let app = AppMachine::app_fetch_first(inner(music_hoard(collection)));
|
let requests = AppMachine::browse_release_group_job(&collection[0].meta.info.musicbrainz);
|
||||||
assert!(matches!(app, AppState::Browse(_)));
|
|
||||||
|
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(()));
|
||||||
|
|
||||||
|
let inner = inner_with_mb(music_hoard(collection), mb_job_sender);
|
||||||
|
let app = AppMachine::app_fetch_first(inner);
|
||||||
|
assert!(matches!(app, AppState::Fetch(_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -743,11 +753,11 @@ mod tests {
|
|||||||
let mut collection = COLLECTION.clone();
|
let mut collection = COLLECTION.clone();
|
||||||
collection[0].albums.clear();
|
collection[0].albums.clear();
|
||||||
|
|
||||||
let (_, rx) = mpsc::channel::<MbApiResult>();
|
let (_tx, rx) = mpsc::channel::<MbApiResult>();
|
||||||
let fetch = FetchState::search(rx);
|
let fetch = FetchState::search(rx);
|
||||||
|
|
||||||
let app = AppMachine::app_fetch_next(inner(music_hoard(collection)), fetch);
|
let app = AppMachine::app_fetch_next(inner(music_hoard(collection)), fetch);
|
||||||
assert!(matches!(app, AppState::Browse(_)));
|
assert!(matches!(app, AppState::Fetch(_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user