mirror of
https://github.com/cubixle/tuu.git
synced 2026-04-30 10:28:48 +01:00
fixed router and added test for prefix
This commit is contained in:
@@ -33,3 +33,17 @@ func Test_Static_Route_Creation(t *testing.T) {
|
||||
route := routes[0]
|
||||
r.Equal("/test-path", route.Path)
|
||||
}
|
||||
|
||||
func Test_Prefix_Route_Creation(t *testing.T) {
|
||||
r := require.New(t)
|
||||
|
||||
router := tuu.NewRouter()
|
||||
router.Prefix("/prefix")
|
||||
|
||||
router.GET("/home", func(ctx tuu.Context) error { return nil })
|
||||
|
||||
routes := router.GetRoutes()
|
||||
r.Len(routes, 1)
|
||||
route := routes[0]
|
||||
r.Contains(route.Path, "/prefix")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user