HEAVY: finish music service migration, tidy up services, more tests
This commit is contained in:
parent
9e311df462
commit
90a671982c
47 changed files with 2698 additions and 902 deletions
26
errors/validation_test.go
Normal file
26
errors/validation_test.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package errors_test
|
||||
|
||||
import (
|
||||
"arimelody-web/errors"
|
||||
goErrors "errors"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func Test_ValidationError(t *testing.T) {
|
||||
var err error
|
||||
message := "invalid input"
|
||||
|
||||
t.Run("can create error", func(t *testing.T) {
|
||||
err = errors.NewValidationError(message)
|
||||
assert.Error(t, err, message)
|
||||
})
|
||||
|
||||
t.Run("validator returns true for valid error", func(t *testing.T) {
|
||||
assert.Equal(t, errors.IsValidationError(err), true)
|
||||
})
|
||||
t.Run("validator returns false for invalid error", func(t *testing.T) {
|
||||
assert.Equal(t, errors.IsValidationError(goErrors.New("other error")), false)
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue