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

Function Test_App_Group

app_test.go:1753–1813  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1751}
1752
1753func Test_App_Group(t *testing.T) {
1754 t.Parallel()
1755 dummyHandler := testEmptyHandler
1756
1757 app := New()
1758
1759 grp := app.Group("/test")
1760 grp.Get("/", dummyHandler)
1761 testStatus200(t, app, "/test", MethodGet)
1762
1763 grp.Get("/:demo?", dummyHandler)
1764 testStatus200(t, app, "/test/john", MethodGet)
1765
1766 grp.Connect("/CONNECT", dummyHandler)
1767 testStatus200(t, app, "/test/CONNECT", MethodConnect)
1768
1769 grp.Put("/PUT", dummyHandler)
1770 testStatus200(t, app, "/test/PUT", MethodPut)
1771
1772 grp.Post("/POST", dummyHandler)
1773 testStatus200(t, app, "/test/POST", MethodPost)
1774
1775 grp.Delete("/DELETE", dummyHandler)
1776 testStatus200(t, app, "/test/DELETE", MethodDelete)
1777
1778 grp.Head("/HEAD", dummyHandler)
1779 testStatus200(t, app, "/test/HEAD", MethodHead)
1780
1781 grp.Patch("/PATCH", dummyHandler)
1782 testStatus200(t, app, "/test/PATCH", MethodPatch)
1783
1784 grp.Options("/OPTIONS", dummyHandler)
1785 testStatus200(t, app, "/test/OPTIONS", MethodOptions)
1786
1787 grp.Trace("/TRACE", dummyHandler)
1788 testStatus200(t, app, "/test/TRACE", MethodTrace)
1789
1790 grp.Query("/QUERY", dummyHandler)
1791 testStatus200(t, app, "/test/QUERY", MethodQuery)
1792
1793 grp.All("/ALL", dummyHandler)
1794 testStatus200(t, app, "/test/ALL", MethodPost)
1795
1796 grp.Use(dummyHandler)
1797 testStatus200(t, app, "/test/oke", MethodGet)
1798
1799 grp.Use("/USE", dummyHandler)
1800 testStatus200(t, app, "/test/USE/oke", MethodGet)
1801
1802 api := grp.Group("/v1")
1803 api.Post("/", dummyHandler)
1804
1805 resp, err := app.Test(httptest.NewRequest(MethodPost, "/test/v1/", http.NoBody))
1806 require.NoError(t, err, "app.Test(req)")
1807 require.Equal(t, 200, resp.StatusCode, "Status code")
1808
1809 api.Get("/users", dummyHandler)
1810 resp, err = app.Test(httptest.NewRequest(MethodGet, "/test/v1/UsErS", http.NoBody))

Callers

nothing calls this directly

Calls 15

testStatus200Function · 0.85
TestMethod · 0.80
NewFunction · 0.70
GroupMethod · 0.65
GetMethod · 0.65
ConnectMethod · 0.65
PutMethod · 0.65
PostMethod · 0.65
DeleteMethod · 0.65
HeadMethod · 0.65
PatchMethod · 0.65
OptionsMethod · 0.65

Tested by

no test coverage detected