Fix unit tests

This commit is contained in:
Wojciech Kozlowski 2025-01-02 21:44:05 +01:00
parent f407b01ea7
commit 6451d001dc

View File

@ -318,7 +318,7 @@ mod tests {
} }
fn artist_match() -> EntityMatches { fn artist_match() -> EntityMatches {
let artist = artist_meta(); let mut artist = artist_meta();
let artist_1 = artist.clone(); let artist_1 = artist.clone();
let artist_match_1 = Entity::with_score(artist_1, 100); let artist_match_1 = Entity::with_score(artist_1, 100);
@ -327,12 +327,14 @@ mod tests {
let mut artist_match_2 = Entity::with_score(artist_2, 100); let mut artist_match_2 = Entity::with_score(artist_2, 100);
artist_match_2.disambiguation = Some(String::from("some disambiguation")); artist_match_2.disambiguation = Some(String::from("some disambiguation"));
artist.clear_db_id();
let list = vec![artist_match_1.clone(), artist_match_2.clone()]; let list = vec![artist_match_1.clone(), artist_match_2.clone()];
EntityMatches::artist_search(artist, list) EntityMatches::artist_search(artist, list)
} }
fn artist_lookup() -> EntityMatches { fn artist_lookup() -> EntityMatches {
let artist = artist_meta(); let mut artist = artist_meta();
artist.clear_db_id();
let lookup = Entity::new(artist.clone()); let lookup = Entity::new(artist.clone());
EntityMatches::artist_lookup(artist, lookup) EntityMatches::artist_lookup(artist, lookup)
} }
@ -530,11 +532,22 @@ mod tests {
match matches_info { match matches_info {
EntityMatches::Album(_) => panic!(), EntityMatches::Album(_) => panic!(),
EntityMatches::Artist(_) => { EntityMatches::Artist(_) => {
let meta = artist_meta(); let mut meta = artist_meta();
let db_id = meta.id.db_id.clone();
meta.clear_db_id();
let mut seq = Sequence::new();
music_hoard music_hoard
.expect_merge_artist_info() .expect_merge_artist_info()
.with(eq(meta.id), eq(meta.info)) .with(eq(meta.id.clone()), eq(meta.info))
.times(1) .times(1)
.in_sequence(&mut seq)
.return_once(|_, _| Ok(()));
music_hoard
.expect_set_artist_db_id()
.with(eq(meta.id.clone()), eq(db_id))
.times(1)
.in_sequence(&mut seq)
.return_once(|_, _| Ok(())); .return_once(|_, _| Ok(()));
} }
} }