testing some error handling
This commit is contained in:
@@ -141,3 +141,30 @@ func TestFetchArtist(t *testing.T) {
|
||||
t.Errorf(`didn't correctly parse the name`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchWrongUrl(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
t.Errorf(`trying to fetch an unknown url should result in error`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNonExistentSourceType(t *testing.T) {
|
||||
RegisterPlugin(MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
SourceType: &data.SourceType{
|
||||
Name: "doesn't exist",
|
||||
},
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
t.Errorf(`trying to fetch a not recognized source type should result in error`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user