split this into its own function
This commit is contained in:
parent
57d0380ca3
commit
cf691a2de2
1 changed files with 18 additions and 13 deletions
|
|
@ -131,23 +131,28 @@ mod test {
|
|||
song.author == "North Point InsideOut"
|
||||
}) {
|
||||
assert_eq!(&song, first);
|
||||
let song = Song::from(song);
|
||||
if let Some(verse_map) = song.verse_map.as_ref() {
|
||||
if verse_map.len() < 2 {
|
||||
return Err(format!(
|
||||
"VerseMap wasn't built right likely: {:?}",
|
||||
song
|
||||
));
|
||||
}
|
||||
} else {
|
||||
return Err(String::from(
|
||||
"There is no VerseMap in this song",
|
||||
));
|
||||
};
|
||||
online_song_to_song(song)?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn online_song_to_song(song: OnlineSong) -> Result<(), String> {
|
||||
let song = Song::from(song);
|
||||
if let Some(verse_map) = song.verse_map.as_ref() {
|
||||
if verse_map.len() < 2 {
|
||||
return Err(format!(
|
||||
"VerseMap wasn't built right likely: {:?}",
|
||||
song
|
||||
));
|
||||
}
|
||||
} else {
|
||||
return Err(String::from(
|
||||
"There is no VerseMap in this song",
|
||||
));
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_online_search() {
|
||||
let search =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue