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.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)
|
|
|
|
})
|
|
|
|
}
|