photoprism/internal/meta/keywords_test.go
Michael Mayer 529103462c Index: Add native support for MP4 and Samsung/Google Motion Photos #439
Related Issues:
- Samsung: Initial support for Motion Photos (#439)
- Google: Initial support for Motion Photos (#1739)
- Metadata: Flag Samsung/Google Motion Photos as Live Photos (#2788)

Related Pull Requests:
- Live Photos: Add Support for Samsung Motion Photos (#3588)
- Samsung: Improved support for Motion Photos (#3660)
- Google: Initial support for Motion Photos (#3709)
- Google: Add support for Motion Photos (#3722)

Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-09-22 23:59:56 +02:00

65 lines
1.2 KiB
Go

package meta
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestData_AddKeywords(t *testing.T) {
t.Run("success", func(t *testing.T) {
data := NewData()
assert.Equal(t, "", data.Keywords.String())
data.AddKeywords("FooBar")
assert.Equal(t, "foobar", data.Keywords.String())
data.AddKeywords("BAZ; pro")
assert.Equal(t, "baz, foobar, pro", data.Keywords.String())
})
t.Run("ignore", func(t *testing.T) {
data := NewData()
assert.Equal(t, "", data.Keywords.String())
data.AddKeywords("Fo")
assert.Equal(t, "fo", data.Keywords.String())
})
}
func TestData_AutoAddKeywords(t *testing.T) {
t.Run("success", func(t *testing.T) {
data := NewData()
assert.Equal(t, "", data.Keywords.String())
data.AutoAddKeywords("FooBar burst baz flash")
assert.Equal(t, "burst", data.Keywords.String())
})
t.Run("ignore", func(t *testing.T) {
data := NewData()
assert.Equal(t, "", data.Keywords.String())
data.AutoAddKeywords("FooBar go pro baz banana")
assert.Equal(t, "", data.Keywords.String())
})
t.Run("ignore because too short", func(t *testing.T) {
data := NewData()
assert.Equal(t, "", data.Keywords.String())
data.AutoAddKeywords("es")
assert.Equal(t, "", data.Keywords.String())
})
}