Skip to content

Commit 6b08fd1

Browse files
committed
remove ai comments from test
1 parent 6d18522 commit 6b08fd1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

agent/agentcontainers/containers_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,35 +137,27 @@ func TestHandler(t *testing.T) {
137137
}
138138

139139
for _, tt := range tests {
140-
tt := tt
141140
t.Run(tt.name, func(t *testing.T) {
142141
t.Parallel()
143142

144-
// Create router with URL parameter handling
143+
// Setup router with the handler under test.
145144
r := chi.NewRouter()
146145
handler := agentcontainers.New(
147146
agentcontainers.WithLister(tt.lister),
148147
agentcontainers.WithDevcontainerCLI(tt.devcontainerCLI),
149148
)
150-
151149
r.Post("/containers/{id}/recreate", handler.Recreate)
152150

153-
// Create test request
151+
// Simulate HTTP request to the recreate endpoint.
154152
req := httptest.NewRequest(http.MethodPost, "/containers/"+tt.containerID+"/recreate", nil)
155153
rec := httptest.NewRecorder()
156-
157-
// Run the handler
158154
r.ServeHTTP(rec, req)
159155

160-
// Check status code - use require to fail fast if this doesn't match
156+
// Check the response status code and body.
161157
require.Equal(t, tt.wantStatus, rec.Code, "status code mismatch")
162-
163-
// For non-empty expected responses, check the body contains the expected message
164158
if tt.wantBody != "" {
165-
// For error responses, contains is appropriate as we don't need to test the entire response
166159
assert.Contains(t, rec.Body.String(), tt.wantBody, "response body mismatch")
167160
} else if tt.wantStatus == http.StatusNoContent {
168-
// For success cases, verify the body is actually empty
169161
assert.Empty(t, rec.Body.String(), "expected empty response body")
170162
}
171163
})

0 commit comments

Comments
 (0)