Skip to content

Commit

Permalink
🧪 update proxy unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fenny committed Oct 15, 2020
1 parent 0db09d9 commit e3c2dfa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions middleware/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import (
"time"

"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/fiber/v2/utils"
)

// go test -run Test_Proxy_Empty_Host
func Test_Proxy_Empty_Upstream_Servers(t *testing.T) {
defer func() {
if r := recover(); r != nil {
utils.AssertEqual(t, "Servers cannot be empty", r)
}
}()
app := fiber.New()
app.Use(recover.New(), Balancer(Config{Servers: []string{}}))

resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusInternalServerError, resp.StatusCode)
app.Use(Balancer(Config{Servers: []string{}}))
}

// go test -run Test_Proxy_Next
Expand Down

0 comments on commit e3c2dfa

Please sign in to comment.