photoprism/internal/entity/subject_fixtures_test.go
2021-08-28 13:55:37 +02:00

33 lines
865 B
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSubjectMap_Get(t *testing.T) {
t.Run("get existing subject", func(t *testing.T) {
r := SubjectFixtures.Get("joe-biden")
assert.Equal(t, "Joe Biden", r.SubjectName)
assert.IsType(t, Subject{}, r)
})
t.Run("get not existing subject", func(t *testing.T) {
r := SubjectFixtures.Get("monstera")
assert.Equal(t, "", r.SubjectName)
assert.IsType(t, Subject{}, r)
})
}
func TestSubjectMap_Pointer(t *testing.T) {
t.Run("get existing subject", func(t *testing.T) {
r := SubjectFixtures.Pointer("joe-biden")
assert.Equal(t, "Joe Biden", r.SubjectName)
assert.IsType(t, &Subject{}, r)
})
t.Run("get not existing subject", func(t *testing.T) {
r := SubjectFixtures.Pointer("monstera")
assert.Equal(t, "", r.SubjectName)
assert.IsType(t, &Subject{}, r)
})
}