Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evg4b committed May 22, 2023
1 parent cd6cbd9 commit ebb76f6
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions internal/config/mappings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package config_test

import (
"net/http"
"testing"

"github.com/evg4b/uncors/internal/config"
Expand Down Expand Up @@ -45,25 +46,34 @@ func TestMappings(t *testing.T) {
To: "https://github.com",
Mocks: []config.Mock{
{
Path: "",
Method: "",
Queries: nil,
Headers: nil,
Response: config.Response{},
Path: "/endpoint-1",
Method: http.MethodPost,
Response: config.Response{
Code: http.StatusOK,
RawContent: "OK",
},
},
{
Path: "",
Method: "",
Queries: nil,
Headers: nil,
Response: config.Response{},
Path: "/demo",
Method: http.MethodGet,
Queries: map[string]string{
"param1": "value1",
},
Response: config.Response{
Code: http.StatusInternalServerError,
RawContent: "ERROR",
},
},
{
Path: "",
Method: "",
Queries: nil,
Headers: nil,
Response: config.Response{},
Path: "/healthcheck",
Method: http.MethodGet,
Headers: map[string]string{
"param1": "value1",
},
Response: config.Response{
Code: http.StatusForbidden,
RawContent: "ERROR",
},
},
},
},
Expand All @@ -72,7 +82,9 @@ func TestMappings(t *testing.T) {
expected: []string{
"https://localhost => https://github.com",
"http://localhost => https://github.com",
"MOCKS: 3 mock(s) registered",
"mock: [POST 200] /endpoint-1",
"mock: [GET 500] /demo",
"mock: [GET 403] /healthcheck",
},
},
}
Expand Down

0 comments on commit ebb76f6

Please sign in to comment.