Add tests for album model
This commit is contained in:
parent
1fec474bd0
commit
67c21ab0d1
1 changed files with 19 additions and 0 deletions
19
internal/models/album_test.go
Normal file
19
internal/models/album_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewAlbum(t *testing.T) {
|
||||
t.Run("name Christmas 2018", func(t *testing.T) {
|
||||
album := NewAlbum("Christmas 2018")
|
||||
assert.Equal(t, "Christmas 2018", album.AlbumName)
|
||||
assert.Equal(t, "christmas-2018", album.AlbumSlug)
|
||||
})
|
||||
t.Run("name empty", func(t *testing.T) {
|
||||
album := NewAlbum("")
|
||||
assert.Equal(t, "New Album", album.AlbumName)
|
||||
assert.Equal(t, "new-album", album.AlbumSlug)
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue