Skip to content

Commit c357141

Browse files
starbopsclaude
andcommitted
fix(tests): resolve integration test failures
- Fix database test error message expectation for email uniqueness Changed from "duplicate" to "already exists" to match PostgreSQL error - Fix concurrent task creation test to use proper string formatting Replace character conversion with fmt.Sprintf for task names - Update OpenAPI validator to match AuthResponse structure Add missing fields: token_type, expires_in, created_at, updated_at Update required fields in both register and login endpoints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 700da65 commit c357141

2 files changed

Lines changed: 21 additions & 12 deletions

File tree

tests/integration/database_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package integration_test
44

55
import (
66
"context"
7+
"fmt"
78
"testing"
89
"time"
910

@@ -85,7 +86,7 @@ func (s *DatabaseIntegrationSuite) TestUserLifecycle() {
8586

8687
err = s.DB.Repositories.Users.Create(ctx, user2)
8788
assert.Error(s.T(), err)
88-
assert.Contains(s.T(), err.Error(), "duplicate") // PostgreSQL constraint error
89+
assert.Contains(s.T(), err.Error(), "already exists") // PostgreSQL constraint error
8990
})
9091
}
9192

@@ -214,7 +215,7 @@ func (s *DatabaseIntegrationSuite) TestConcurrentAccess() {
214215
for i := 0; i < numTasks; i++ {
215216
go func(index int) {
216217
task := testutil.NewTaskFactory(user.ID).
217-
WithName("Concurrent Task " + string(rune(index))).
218+
WithName(fmt.Sprintf("Concurrent Task %d", index)).
218219
Build()
219220

220221
err := s.DB.Repositories.Tasks.Create(ctx, task)

tests/testutil/openapi_validator.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,20 @@ func loadOpenAPISpec() *OpenAPISpec {
8989
"user": {
9090
Type: "object",
9191
Properties: map[string]*SchemaSpec{
92-
"id": {Type: "string"},
93-
"email": {Type: "string"},
94-
"name": {Type: "string"},
92+
"id": {Type: "string"},
93+
"email": {Type: "string"},
94+
"name": {Type: "string"},
95+
"created_at": {Type: "string"},
96+
"updated_at": {Type: "string"},
9597
},
96-
Required: []string{"id", "email", "name"},
98+
Required: []string{"id", "email", "name", "created_at", "updated_at"},
9799
},
98100
"access_token": {Type: "string"},
99101
"refresh_token": {Type: "string"},
102+
"token_type": {Type: "string"},
103+
"expires_in": {Type: "integer"},
100104
},
101-
Required: []string{"user", "access_token", "refresh_token"},
105+
Required: []string{"user", "access_token", "refresh_token", "token_type", "expires_in"},
102106
},
103107
},
104108
},
@@ -137,16 +141,20 @@ func loadOpenAPISpec() *OpenAPISpec {
137141
"user": {
138142
Type: "object",
139143
Properties: map[string]*SchemaSpec{
140-
"id": {Type: "string"},
141-
"email": {Type: "string"},
142-
"name": {Type: "string"},
144+
"id": {Type: "string"},
145+
"email": {Type: "string"},
146+
"name": {Type: "string"},
147+
"created_at": {Type: "string"},
148+
"updated_at": {Type: "string"},
143149
},
144-
Required: []string{"id", "email", "name"},
150+
Required: []string{"id", "email", "name", "created_at", "updated_at"},
145151
},
146152
"access_token": {Type: "string"},
147153
"refresh_token": {Type: "string"},
154+
"token_type": {Type: "string"},
155+
"expires_in": {Type: "integer"},
148156
},
149-
Required: []string{"user", "access_token", "refresh_token"},
157+
Required: []string{"user", "access_token", "refresh_token", "token_type", "expires_in"},
150158
},
151159
},
152160
},

0 commit comments

Comments
 (0)