Skip to content

Commit 14a8635

Browse files
authored
Simplify test
1 parent cd0b631 commit 14a8635

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

app_test.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,6 @@ func Test_App_Add_Method_Test(t *testing.T) {
609609

610610
func Test_App_All_Method_Test(t *testing.T) {
611611
t.Parallel()
612-
defer func() {
613-
if err := recover(); err != nil {
614-
require.Equal(t, "add: invalid http method JANE\n", fmt.Sprintf("%v", err))
615-
}
616-
}()
617612

618613
methods := append(DefaultMethods, "JOHN") //nolint:gocritic // We want a new slice here
619614
app := New(Config{
@@ -628,11 +623,9 @@ func Test_App_All_Method_Test(t *testing.T) {
628623
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
629624

630625
// Add a new method
631-
app.Add([]string{"JANE"}, "/doe", testEmptyHandler)
632-
633-
resp, err = app.Test(httptest.NewRequest("JANE", "/doe", nil))
634-
require.NoError(t, err, "app.Test(req)")
635-
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
626+
require.Panics(t, func() {
627+
app.Add([]string{"JANE"}, "/jane", testEmptyHandler)
628+
})
636629
}
637630

638631
// go test -run Test_App_GETOnly

0 commit comments

Comments
 (0)