fix(logger): Improve test assertions based on golangci-lint

pull/3359/head
edvardsanta 2025-03-18 22:50:21 -03:00
parent a67fc2a3ea
commit 6ec4e8eb1b
1 changed files with 4 additions and 4 deletions

View File

@ -537,7 +537,7 @@ func Test_Logger_Combined_CLF_Format_With_Name(t *testing.T) {
require.NoError(t, err)
require.Equal(t, fiber.StatusNotFound, resp.StatusCode)
expected := fmt.Sprintf("0.0.0.0 - - [%s] \"%s %s %s\" %d %d \"%s\" \"%s\"\n",
expected := fmt.Sprintf("0.0.0.0 - - [%s] \"%q %q %q\" %d %d \"%q\" \"%q\"\n",
time.Now().Format("15:04:05"),
fiber.MethodGet, "/?foo=bar", "HTTP/1.1",
fiber.StatusNotFound,
@ -568,7 +568,7 @@ func Test_Logger_Combined_CLF_Format_With_Const(t *testing.T) {
require.NoError(t, err)
require.Equal(t, fiber.StatusNotFound, resp.StatusCode)
expected := fmt.Sprintf("0.0.0.0 - - [%s] \"%s %s %s\" %d %d \"%s\" \"%s\"\n",
expected := fmt.Sprintf("0.0.0.0 - - [%s] \"%q %q %q\" %d %d \"%q\" \"%q\"\n",
time.Now().Format("15:04:05"),
fiber.MethodGet, "/?foo=bar", "HTTP/1.1",
fiber.StatusNotFound,
@ -597,7 +597,7 @@ func Test_Logger_Json_Format_With_Name(t *testing.T) {
require.Equal(t, fiber.StatusNotFound, resp.StatusCode)
expected := fmt.Sprintf(
"{\"time\":\"%s\",\"ip\":\"%s\",\"method\":\"%s\",\"url\":\"%s\",\"status\":%d,\"bytesSent\":%d}\n",
"{\"time\":\"%q\",\"ip\":\"%q\",\"method\":\"%q\",\"url\":\"%q\",\"status\":%d,\"bytesSent\":%d}\n",
time.Now().Format("15:04:05"),
"0.0.0.0",
fiber.MethodGet,
@ -627,7 +627,7 @@ func Test_Logger_Json_Format_With_Const(t *testing.T) {
require.Equal(t, fiber.StatusNotFound, resp.StatusCode)
expected := fmt.Sprintf(
"{\"time\":\"%s\",\"ip\":\"%s\",\"method\":\"%s\",\"url\":\"%s\",\"status\":%d,\"bytesSent\":%d}\n",
"{\"time\":\"%q\",\"ip\":\"%q\",\"method\":\"%q\",\"url\":\"%q\",\"status\":%d,\"bytesSent\":%d}\n",
time.Now().Format("15:04:05"),
"0.0.0.0",
fiber.MethodGet,