You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
507 B
Go
25 lines
507 B
Go
package user
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.runcible.io/learning/ratchet/internal/apperror"
|
|
)
|
|
|
|
func TestUserValidation(t *testing.T) {
|
|
t.Run("user should return invalid", func(t *testing.T) {
|
|
u := &User{}
|
|
if apperror.ErrorCode(u.Validate()) != apperror.EINVALID {
|
|
t.Errorf("User validation should have failed but passed instead.")
|
|
}
|
|
})
|
|
|
|
t.Run("user validation should pass", func(t *testing.T) {
|
|
u := &User{Name: "Drew"}
|
|
if u.Validate() != nil {
|
|
t.Errorf("User validation failed")
|
|
}
|
|
})
|
|
|
|
}
|