model function unit tests!

This commit is contained in:
ari melody 2025-03-24 19:39:10 +00:00
parent e5ae167550
commit 6db35b2f99
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
9 changed files with 254 additions and 16 deletions

23
model/artist_test.go Normal file
View 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)
}
}