2019-12-11 16:55:18 +01:00
|
|
|
package entity
|
2019-12-04 15:14:04 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2019-12-11 14:10:20 +01:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2019-12-04 15:14:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewPhotoAlbum(t *testing.T) {
|
|
|
|
t.Run("new album", func(t *testing.T) {
|
|
|
|
m := NewPhotoAlbum("ABC", "EFG")
|
|
|
|
assert.Equal(t, "ABC", m.PhotoUUID)
|
|
|
|
assert.Equal(t, "EFG", m.AlbumUUID)
|
|
|
|
})
|
|
|
|
}
|
2019-12-17 18:27:25 +01:00
|
|
|
|
|
|
|
func TestPhotoAlbum_TableName(t *testing.T) {
|
|
|
|
photoAlbum := &PhotoAlbum{}
|
|
|
|
tableName := photoAlbum.TableName()
|
|
|
|
|
|
|
|
assert.Equal(t, "photos_albums", tableName)
|
|
|
|
}
|
2020-05-08 14:18:11 +02:00
|
|
|
|
|
|
|
func TestPhotoAlbum_FirstOrCreate(t *testing.T) {
|
2020-05-11 14:41:20 +02:00
|
|
|
m := PhotoAlbumFixtures.Get("1", "pt9jtdre2lvl0yh7", "at9lxuqxpogaaba8")
|
|
|
|
r := m.FirstOrCreate()
|
2020-05-08 14:18:11 +02:00
|
|
|
assert.Equal(t, "at9lxuqxpogaaba8", r.AlbumUUID)
|
|
|
|
}
|