37 lines
752 B
Go
37 lines
752 B
Go
|
package user
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestCreate(t *testing.T) {
|
||
|
t.Run("check nil", func(t *testing.T) {
|
||
|
if _, err := Create(context.Background(), nil); err == nil {
|
||
|
t.Error("nil check error expected")
|
||
|
}
|
||
|
})
|
||
|
|
||
|
t.Run("trigger validation errors", func(t *testing.T) {
|
||
|
if _, err := Create(context.Background(), &CreateInput{}); err == nil {
|
||
|
t.Error("validation errors are expected")
|
||
|
} else {
|
||
|
t.Log(err)
|
||
|
}
|
||
|
})
|
||
|
|
||
|
t.Run("create", func(t *testing.T) {
|
||
|
if _, err := Create(context.Background(), &CreateInput{
|
||
|
Email: "aa@aa.com",
|
||
|
Pwd: "pwd123",
|
||
|
ConfirmPwd: "pwd123",
|
||
|
FirstName: "Ankit",
|
||
|
MiddleName: "Singh",
|
||
|
LastName: "Patial",
|
||
|
RoleID: 1,
|
||
|
}); err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
})
|
||
|
}
|