photoprism/internal/entity/cell_fixtures_test.go
Michael Mayer 5648c9616e Backend: Refactor location data tables and entities
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-07-12 08:27:05 +02:00

34 lines
941 B
Go

package entity
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestLocationMap_Get(t *testing.T) {
t.Run("get existing location", func(t *testing.T) {
r := CellFixtures.Get("mexico")
assert.Equal(t, "Adosada Platform", r.CellName)
assert.Equal(t, "s2:85d1ea7d382c", r.ID)
assert.IsType(t, Cell{}, r)
})
t.Run("get not existing location", func(t *testing.T) {
r := CellFixtures.Get("Fusion 3333")
assert.Equal(t, "zz", r.ID)
assert.IsType(t, Cell{}, r)
})
}
func TestLocationMap_Pointer(t *testing.T) {
t.Run("get existing location pointer", func(t *testing.T) {
r := CellFixtures.Pointer("mexico")
assert.Equal(t, "Adosada Platform", r.CellName)
assert.Equal(t, "s2:85d1ea7d382c", r.ID)
assert.IsType(t, &Cell{}, r)
})
t.Run("get not existing location pointer", func(t *testing.T) {
r := CellFixtures.Pointer("Fusion 444")
assert.Equal(t, "zz", r.ID)
assert.IsType(t, &Cell{}, r)
})
}