2020-05-06 17:05:06 +02:00
|
|
|
package form
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewAlbum(t *testing.T) {
|
|
|
|
t.Run("success", func(t *testing.T) {
|
|
|
|
var album = struct {
|
2020-05-26 09:02:19 +02:00
|
|
|
AlbumTitle string
|
2020-05-06 17:05:06 +02:00
|
|
|
AlbumDescription string
|
|
|
|
AlbumNotes string
|
|
|
|
AlbumOrder string
|
|
|
|
AlbumTemplate string
|
|
|
|
AlbumFavorite bool
|
|
|
|
}{
|
2020-05-26 09:02:19 +02:00
|
|
|
AlbumTitle: "Foo",
|
2020-05-06 17:05:06 +02:00
|
|
|
AlbumDescription: "bar",
|
|
|
|
AlbumNotes: "test notes",
|
|
|
|
AlbumOrder: "newest",
|
|
|
|
AlbumTemplate: "default",
|
|
|
|
AlbumFavorite: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
r, err := NewAlbum(album)
|
|
|
|
|
|
|
|
if err != nil {
|
2020-05-08 19:34:29 +02:00
|
|
|
t.Fatal(err)
|
2020-05-06 17:05:06 +02:00
|
|
|
}
|
|
|
|
|
2020-05-26 09:02:19 +02:00
|
|
|
assert.Equal(t, "Foo", r.AlbumTitle)
|
2020-05-06 17:05:06 +02:00
|
|
|
assert.Equal(t, "bar", r.AlbumDescription)
|
|
|
|
assert.Equal(t, "test notes", r.AlbumNotes)
|
|
|
|
assert.Equal(t, "newest", r.AlbumOrder)
|
|
|
|
assert.Equal(t, "default", r.AlbumTemplate)
|
|
|
|
assert.Equal(t, true, r.AlbumFavorite)
|
|
|
|
})
|
|
|
|
}
|