| 482 | } |
| 483 | |
| 484 | func Test_Domain_NameWithGroup(t *testing.T) { |
| 485 | t.Parallel() |
| 486 | |
| 487 | app := New() |
| 488 | |
| 489 | // When Domain is used with Route(prefix, fn, name), the group Name() |
| 490 | // should apply properly via delegation to the underlying group. |
| 491 | api := app.Domain("api.example.com") |
| 492 | api.Route("/v1", func(r Router) { |
| 493 | r.Get("/items", func(c Ctx) error { |
| 494 | return c.SendString("items") |
| 495 | }).Name("items-list") |
| 496 | }, "v1.") |
| 497 | |
| 498 | var found bool |
| 499 | for _, routes := range app.Stack() { |
| 500 | for _, route := range routes { |
| 501 | if route.Name == "v1.items-list" { |
| 502 | found = true |
| 503 | break |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | require.True(t, found, "route should be named 'v1.items-list'") |
| 508 | } |
| 509 | |
| 510 | func Test_Domain_RouteChain(t *testing.T) { |
| 511 | t.Parallel() |