photoprism/internal/entity/lens_fixtures_test.go

36 lines
925 B
Go
Raw Normal View History

2020-05-14 15:04:53 +02:00
package entity
import (
"testing"
2020-11-21 18:08:41 +01:00
"github.com/stretchr/testify/assert"
2020-05-14 15:04:53 +02:00
)
func TestLensMap_Get(t *testing.T) {
t.Run("get existing lens", func(t *testing.T) {
r := LensFixtures.Get("lens-f-380")
assert.Equal(t, uint(1000000), r.ID)
assert.Equal(t, "lens-f-380", r.LensSlug)
assert.IsType(t, Lens{}, r)
})
t.Run("get not existing lens", func(t *testing.T) {
r := LensFixtures.Get("Lens 123")
assert.Equal(t, "lens-123", r.LensSlug)
assert.IsType(t, Lens{}, r)
})
}
func TestLensMap_Pointer(t *testing.T) {
t.Run("get existing lens pointer", func(t *testing.T) {
r := LensFixtures.Pointer("lens-f-380")
assert.Equal(t, uint(1000000), r.ID)
assert.Equal(t, "lens-f-380", r.LensSlug)
assert.IsType(t, &Lens{}, r)
})
t.Run("get not existing lens pointer", func(t *testing.T) {
r := LensFixtures.Pointer("Lens new")
assert.Equal(t, "lens-new", r.LensSlug)
assert.IsType(t, &Lens{}, r)
})
}