44 lines
650 B
Go
44 lines
650 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestUserOK(t *testing.T) {
|
|
type args struct {
|
|
ctx context.Context
|
|
user *User
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{
|
|
name: "test ok",
|
|
args: args{
|
|
ctx: context.TODO(),
|
|
user: &User{
|
|
Name: "hola",
|
|
},
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "test not found",
|
|
args: args{
|
|
ctx: context.TODO(),
|
|
user: nil,
|
|
},
|
|
want: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := UserOK(tt.args.ctx, tt.args.user); got != tt.want {
|
|
t.Errorf("UserOK() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|