photoprism/pkg/txt/strings_test.go
Michael Mayer 5c2ae9e698 Backend: Refactor txt package #260
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-31 15:17:01 +02:00

31 lines
670 B
Go

package txt
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestContainsNumber(t *testing.T) {
t.Run("True", func(t *testing.T) {
assert.Equal(t, true, ContainsNumber("f3abcde"))
})
t.Run("False", func(t *testing.T) {
assert.Equal(t, false, ContainsNumber("abcd"))
})
}
func TestBool(t *testing.T) {
t.Run("not empty", func(t *testing.T) {
assert.Equal(t, true, Bool("Browse your life in pictures"))
})
t.Run("no", func(t *testing.T) {
assert.Equal(t, false, Bool("no"))
})
t.Run("false", func(t *testing.T) {
assert.Equal(t, false, Bool("false"))
})
t.Run("empty", func(t *testing.T) {
assert.Equal(t, false, Bool(""))
})
}