photoprism/internal/entity/marker_fixtures_test.go

36 lines
924 B
Go
Raw Normal View History

2021-06-23 15:34:19 +02:00
package entity
import (
2021-06-28 12:45:00 +02:00
"testing"
2021-07-05 16:41:43 +02:00
"github.com/stretchr/testify/assert"
2021-06-23 15:34:19 +02:00
)
func TestMarkerMap_Get(t *testing.T) {
t.Run("get existing marker", func(t *testing.T) {
r := MarkerFixtures.Get("1000003-3")
assert.Equal(t, "Center", r.MarkerLabel)
assert.Equal(t, float32(0.5), r.Y)
assert.IsType(t, Marker{}, r)
})
t.Run("get not existing marker", func(t *testing.T) {
r := MarkerFixtures.Get("XXX")
assert.Equal(t, *UnknownMarker, r)
assert.IsType(t, Marker{}, r)
})
}
func TestMarkerMap_Pointer(t *testing.T) {
t.Run("get existing marker pointer", func(t *testing.T) {
r := MarkerFixtures.Pointer("1000003-3")
assert.Equal(t, "Center", r.MarkerLabel)
assert.Equal(t, float32(0.5), r.Y)
assert.IsType(t, &Marker{}, r)
})
t.Run("get not existing marker pointer", func(t *testing.T) {
r := MarkerFixtures.Pointer("XXX")
assert.Equal(t, UnknownMarker, r)
assert.IsType(t, &Marker{}, r)
})
}