(t *testing.T)
| 707 | } |
| 708 | |
| 709 | func TestEchoWrapHandler(t *testing.T) { |
| 710 | e := New() |
| 711 | |
| 712 | var actualID string |
| 713 | var actualPattern string |
| 714 | e.GET("/:id", WrapHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 715 | w.WriteHeader(http.StatusOK) |
| 716 | w.Write([]byte("test")) |
| 717 | actualID = r.PathValue("id") |
| 718 | actualPattern = r.Pattern |
| 719 | }))) |
| 720 | |
| 721 | req := httptest.NewRequest(http.MethodGet, "/123", nil) |
| 722 | rec := httptest.NewRecorder() |
| 723 | e.ServeHTTP(rec, req) |
| 724 | |
| 725 | assert.Equal(t, http.StatusOK, rec.Code) |
| 726 | assert.Equal(t, "test", rec.Body.String()) |
| 727 | assert.Equal(t, "123", actualID) |
| 728 | assert.Equal(t, "/:id", actualPattern) |
| 729 | } |
| 730 | |
| 731 | func TestEchoWrapMiddleware(t *testing.T) { |
| 732 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…