tests: implemented go user api tests

This commit is contained in:
2025-01-04 21:30:29 +00:00
parent 48aae18736
commit f8933bee15
11 changed files with 289 additions and 84 deletions
@@ -1,23 +0,0 @@
package services_test
import "testing"
func TestCreateUserService(t *testing.T) {
mockRepo := mocks.NewMockUserRepository()
service := services.NewUserService(mockRepo)
user := entities.UserCreate{
Email: "service@test.com",
Name: "Jane Doe",
Password: "securepassword",
}
result := service.CreateUser(context.Background(), user)
assert.True(t, result.IsRight(), "Expected service to create user")
result.Map(func(user entities.User) {
assert.Equal(t, "service@test.com", user.Email)
assert.Equal(t, "Jane Doe", user.Name)
})
}