photoprism/internal/entity/album_fixtures_test.go

36 lines
989 B
Go
Raw Normal View History

2020-05-12 13:52:09 +02:00
package entity
import (
"testing"
2020-11-21 18:08:41 +01:00
"github.com/stretchr/testify/assert"
2020-05-12 13:52:09 +02:00
)
func TestAlbumMap_Get(t *testing.T) {
t.Run("get existing album", func(t *testing.T) {
r := AlbumFixtures.Get("christmas2030")
assert.Equal(t, "at9lxuqxpogaaba7", r.AlbumUID)
2021-07-22 13:53:17 +02:00
assert.Equal(t, "christmas-2030", r.AlbumSlug)
2020-05-12 13:52:09 +02:00
assert.IsType(t, Album{}, r)
})
t.Run("get not existing album", func(t *testing.T) {
r := AlbumFixtures.Get("Fusion 3333")
assert.Equal(t, "fusion-3333", r.AlbumSlug)
assert.IsType(t, Album{}, r)
})
}
func TestAlbumMap_Pointer(t *testing.T) {
t.Run("get existing album pointer", func(t *testing.T) {
r := AlbumFixtures.Pointer("christmas2030")
assert.Equal(t, "at9lxuqxpogaaba7", r.AlbumUID)
2021-07-22 13:53:17 +02:00
assert.Equal(t, "christmas-2030", r.AlbumSlug)
2020-05-12 13:52:09 +02:00
assert.IsType(t, &Album{}, r)
})
t.Run("get not existing album pointer", func(t *testing.T) {
r := AlbumFixtures.Pointer("Fusion 444")
assert.Equal(t, "fusion-444", r.AlbumSlug)
assert.IsType(t, &Album{}, r)
})
}