photoprism/pkg/clean/unicode_test.go
Michael Mayer 18f1d5a6f8 Metadata: Improve data parsing and sanitization #2897
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-11-17 08:28:30 +01:00

22 lines
552 B
Go

package clean
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUnicode(t *testing.T) {
t.Run("Valid", func(t *testing.T) {
assert.Equal(t, "Naïve bonds and futures surge as inflation eases 🚀🚀🚀", Unicode("Naïve bonds and futures surge as inflation eases 🚀🚀🚀"))
})
t.Run("Null", func(t *testing.T) {
assert.Equal(t, "\x00", Unicode("\x00"))
})
t.Run("FFFD", func(t *testing.T) {
assert.Equal(t, "", Unicode("\uFFFD"))
})
t.Run("Empty", func(t *testing.T) {
assert.Equal(t, "", Unicode(""))
})
}