(t *testing.T)
| 134 | } |
| 135 | |
| 136 | func TestRoute_ForGroup(t *testing.T) { |
| 137 | route := Route{ |
| 138 | Method: http.MethodGet, |
| 139 | Path: "/test", |
| 140 | Handler: func(c *Context) error { |
| 141 | return c.String(http.StatusTeapot, "OK") |
| 142 | }, |
| 143 | Middlewares: nil, |
| 144 | Name: "test route", |
| 145 | } |
| 146 | |
| 147 | mw := func(next HandlerFunc) HandlerFunc { |
| 148 | return func(c *Context) error { |
| 149 | return next(c) |
| 150 | } |
| 151 | } |
| 152 | r := route.WithPrefix("/users", []MiddlewareFunc{mw}) |
| 153 | |
| 154 | assert.Equal(t, r.Method, http.MethodGet) |
| 155 | assert.Equal(t, r.Path, "/users/test") |
| 156 | assert.NotNil(t, r.Handler) |
| 157 | assert.Len(t, r.Middlewares, 1) |
| 158 | assert.Equal(t, r.Name, "test route") |
| 159 | } |
| 160 | |
| 161 | func exampleRoutes() Routes { |
| 162 | return Routes{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…