91cc358fc5
Signed-off-by: Michael Mayer <michael@photoprism.app>
26 lines
649 B
Go
26 lines
649 B
Go
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>}")))
|
|
})
|
|
}
|