test inti
Some checks failed
/ upload-many (push) Failing after 1m16s

This commit is contained in:
jaime merino 2026-01-28 16:21:17 +01:00
commit 491131321a
6 changed files with 136 additions and 0 deletions

27
pkg/app/app.go Normal file
View file

@ -0,0 +1,27 @@
package app
import (
"context"
"fmt"
)
func RunApp(ctx context.Context) error {
u := &User{
Name: "hola",
}
if !UserOK(ctx, u) {
return fmt.Errorf("could not found user")
}
return nil
}
type User struct {
Name string
}
func UserOK(ctx context.Context, user *User) bool {
if user == nil {
return false
}
return true
}

44
pkg/app/app_test.go Normal file
View file

@ -0,0 +1,44 @@
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)
}
})
}
}