package mb import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestShouldBeEqualToArtist(t *testing.T) { m := NewMusicBrainzSearch() err := m.SearchForArtist("Metallica") if err != nil { fmt.Printf("Error on search_for_artist with parameter Metallica\n") return } name, err := m.GetArtistName() if err != nil { fmt.Printf("Error on get_artist_name: no artist found\n") } assert.Equal(t, name, "Metallica") } func TestIfArtistIsValidThenErrIsNil(t *testing.T) { m := NewMusicBrainzSearch() err := m.SearchForArtist("Metallica") assert.Nil(t, err, "err should be nil if found artist") } func TestErrShouldContainErrorIfArtistIsInvalid(t *testing.T) { m := NewMusicBrainzSearch() err := m.SearchForArtist("asdfkjahsdflkjasdhfoia") assert.NotNil(t, err, "err should not be nil if found artist") }