photoprism/pkg/clean/error_test.go

27 lines
649 B
Go
Raw Normal View History

package clean
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestLogError(t *testing.T) {
t.Run("Nil", func(t *testing.T) {
assert.Equal(t, "no error", Error(nil))
})
t.Run("Empty", func(t *testing.T) {
assert.Equal(t, "unknown error", Error(errors.New("")))
})
t.Run("Simple", func(t *testing.T) {
assert.Equal(t, "simple", Error(errors.New("simple")))
})
t.Run("Spaces", func(t *testing.T) {
assert.Equal(t, "'the quick brown fox'", Error(errors.New("the quick brown fox")))
})
t.Run("Invalid", func(t *testing.T) {
assert.Equal(t, "?", Error(errors.New("${https://<host>:<port>/<path>}")))
})
}