mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-02 19:16:23 -07:00
fix code smells for deepsource
This commit is contained in:
parent
c43a15bb0a
commit
3b8fcc2558
1 changed files with 4 additions and 6 deletions
|
@ -75,8 +75,8 @@ func TestServeErrorPage(t *testing.T) {
|
||||||
assert.Equal(t, "text/html; charset=utf-8", writer.Header().Get("Content-Type"))
|
assert.Equal(t, "text/html; charset=utf-8", writer.Header().Get("Content-Type"))
|
||||||
|
|
||||||
// Check the response body for the error message
|
// Check the response body for the error message
|
||||||
//assert.Contains(t, body, err) // Check if the body contains the error message
|
//assert.Contains(t, body, err) Check if the body contains the error message
|
||||||
//assert.Contains(t, body, "Error") // Check if the body contains the error title or header
|
//assert.Contains(t, body, "Error") Check if the body contains the error title or header
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServeError(t *testing.T) {
|
func TestServeError(t *testing.T) {
|
||||||
|
@ -132,11 +132,9 @@ func TestServeError(t *testing.T) {
|
||||||
if responseMap["error"] != tt.expected {
|
if responseMap["error"] != tt.expected {
|
||||||
t.Errorf("Expected error %v, got %v", tt.expected, responseMap["error"])
|
t.Errorf("Expected error %v, got %v", tt.expected, responseMap["error"])
|
||||||
}
|
}
|
||||||
} else {
|
} else if rr.Body.String() != tt.expected {
|
||||||
// Check if the response body matches the expected error message
|
// Check if the response body matches the expected error message
|
||||||
if rr.Body.String() != tt.expected {
|
t.Errorf("Expected response %v, got %v", tt.expected, rr.Body.String())
|
||||||
t.Errorf("Expected response %v, got %v", tt.expected, rr.Body.String())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue