photoprism/internal/entity/keyword_test.go

27 lines
571 B
Go
Raw Normal View History

2019-12-17 18:26:33 +01:00
package entity
import (
"testing"
"github.com/stretchr/testify/assert"
2019-12-17 18:26:33 +01:00
)
func TestNewKeyword(t *testing.T) {
t.Run("cat", func(t *testing.T) {
keyword := NewKeyword("cat")
assert.Equal(t, "cat", keyword.Keyword)
assert.Equal(t, false, keyword.Skip)
})
t.Run("TABle", func(t *testing.T) {
keyword := NewKeyword("TABle")
assert.Equal(t, "table", keyword.Keyword)
assert.Equal(t, false, keyword.Skip)
})
}
2020-05-08 10:21:03 +02:00
func TestKeyword_FirstOrCreate(t *testing.T) {
keyword := NewKeyword("food")
r := keyword.FirstOrCreate()
assert.Equal(t, "food", r.Keyword)
}