Skip to content

Commit

Permalink
Add test on group params inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Nov 21, 2024
1 parent f8ab42a commit 64a2a9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 0 additions & 1 deletion ctx_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestParam(t *testing.T) {
require.Equal(t, http.StatusOK, w.Code)
require.Equal(t, "hey18true", w.Body.String())
})

})

t.Run("Should enforce Required", func(t *testing.T) {
Expand Down
21 changes: 21 additions & 0 deletions mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,27 @@ func TestRegister(t *testing.T) {
})
}

func TestGroupInheritance(t *testing.T) {
s := NewServer()
group := Group(s, "/group",
OptionHeader("Header-1", ""),
)
group2 := Group(group, "/group2",
OptionHeader("Header-2", ""),
)

t.Run("group inheritance", func(t *testing.T) {
route := Get(group2, "/test", func(ctx *ContextNoBody) (string, error) {
return "test", nil
})

t.Log(route.Params)
require.Len(t, route.Params, 2)
require.Contains(t, route.Params, "Header-1")
require.Contains(t, route.Params, "Header-2")
})
}

func TestGroupTagsOnRoute(t *testing.T) {
t.Run("route tag inheritance", func(t *testing.T) {
s := NewServer().
Expand Down

0 comments on commit 64a2a9d

Please sign in to comment.