model function unit tests!
This commit is contained in:
parent
e5ae167550
commit
6db35b2f99
9 changed files with 254 additions and 16 deletions
23
model/artist_test.go
Normal file
23
model/artist_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_Artist_GetAvatar(t *testing.T) {
|
||||
want := "testavatar.png"
|
||||
artist := Artist{ Avatar: want }
|
||||
|
||||
got := artist.GetAvatar()
|
||||
if want != got {
|
||||
t.Errorf(`correct value not returned when avatar is populated (want "%s", got "%s")`, want, got)
|
||||
}
|
||||
|
||||
artist = Artist{}
|
||||
|
||||
want = "/img/default-avatar.png"
|
||||
got = artist.GetAvatar()
|
||||
if want != got {
|
||||
t.Errorf(`default value not returned when avatar is empty (want "%s", got "%s")`, want, got)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue