Skip to content

Commit

Permalink
add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 10, 2020
1 parent 83177b1 commit 9d1cafa
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,28 @@ func TestRouter_Controller(t *testing.T) {
is.Equal(200, w.Code)
is.Equal("hello, in /", w.Body.String())

w = testutil.MockRequest(r, http.MethodGet, "/", nil)
w = testutil.MockRequest(r, http.MethodGet, "", nil)
is.Equal(200, w.Code)
is.Equal("hello, in /", w.Body.String())
is.Equal("hello, in ", w.Body.String())

Debug(false)
}

func TestRouter_Controller2(t *testing.T) {
is := assert.New(t)
r := New()

r.Controller("", &SiteController{})

w := testutil.MockRequest(r, http.MethodGet, "/", nil)
is.Equal(200, w.Code)
is.Equal("hello, in /", w.Body.String())

w = testutil.MockRequest(r, http.MethodGet, "", nil)
is.Equal(200, w.Code)
is.Equal("hello, in ", w.Body.String())
}

func TestDynamicRoute(t *testing.T) {
is := assert.New(t)

Expand Down

0 comments on commit 9d1cafa

Please sign in to comment.