fix: make test purpose method private (#4649)

This commit is contained in:
Kevin Wan
2025-02-14 00:31:53 +08:00
committed by GitHub
parent 15842c3c7a
commit 6a988dc4a9
2 changed files with 23 additions and 23 deletions

View File

@@ -231,7 +231,7 @@ func TestWithFileServerMiddleware(t *testing.T) {
req := httptest.NewRequest(http.MethodGet, tt.requestPath, nil)
rr := httptest.NewRecorder()
server.ServeHTTP(rr, req)
server.serve(rr, req)
assert.Equal(t, tt.expectedStatus, rr.Code)
if len(tt.expectedContent) > 0 {
@@ -458,7 +458,7 @@ Port: 54321
// we would need to verify the behavior here. Since we don't have
// direct access to headers, we'll mock newCorsRouter to capture it.
w := httptest.NewRecorder()
svr.ServeHTTP(w, httptest.NewRequest(http.MethodOptions, "/", nil))
svr.serve(w, httptest.NewRequest(http.MethodOptions, "/", nil))
vals := w.Header().Values("Access-Control-Allow-Headers")
respHeaders := make(map[string]struct{})
@@ -748,7 +748,7 @@ Port: 54321
t.Run(test.name, func(t *testing.T) {
w := httptest.NewRecorder()
req, _ := http.NewRequest("GET", test.path, nil)
svr.ServeHTTP(w, req)
svr.serve(w, req)
assert.Equal(t, test.code, w.Code)
})
}
@@ -765,6 +765,6 @@ func TestServerEmbedFileSystem(t *testing.T) {
req, err := http.NewRequest(http.MethodGet, "/assets/sample.txt", http.NoBody)
assert.Nil(t, err)
rr := httptest.NewRecorder()
server.ServeHTTP(rr, req)
server.serve(rr, req)
assert.Equal(t, sampleContent, rr.Body.String())
}