photoprism/internal/entity/subject_fixtures_test.go

34 lines
853 B
Go
Raw Normal View History

2021-08-26 18:02:53 +02:00
package entity
import (
"testing"
2021-08-28 13:55:37 +02:00
"github.com/stretchr/testify/assert"
2021-08-26 18:02:53 +02:00
)
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.SubjName)
2021-08-26 18:02:53 +02:00
assert.IsType(t, Subject{}, r)
})
t.Run("get not existing subject", func(t *testing.T) {
r := SubjectFixtures.Get("monstera")
assert.Equal(t, "", r.SubjName)
2021-08-26 18:02:53 +02:00
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.SubjName)
2021-08-26 18:02:53 +02:00
assert.IsType(t, &Subject{}, r)
})
t.Run("get not existing subject", func(t *testing.T) {
r := SubjectFixtures.Pointer("monstera")
assert.Equal(t, "", r.SubjName)
2021-08-26 18:02:53 +02:00
assert.IsType(t, &Subject{}, r)
})
}