MCPcopy
hub / github.com/gofiber/fiber / Test_Domain_NameWithGroup

Function Test_Domain_NameWithGroup

domain_test.go:484–508  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

482}
483
484func 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
510func Test_Domain_RouteChain(t *testing.T) {
511 t.Parallel()

Callers

nothing calls this directly

Calls 7

StackMethod · 0.80
NewFunction · 0.70
DomainMethod · 0.65
RouteMethod · 0.65
NameMethod · 0.65
GetMethod · 0.65
SendStringMethod · 0.65

Tested by

no test coverage detected