MCPcopy
hub / github.com/pocketbase/pocketbase / TestRouterGroupRouteAliases

Function TestRouterGroupRouteAliases

tools/router/group_test.go:237–315  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestRouterGroupRouteAliases(t *testing.T) {
238 t.Parallel()
239
240 group := RouterGroup[*Event]{}
241
242 testErr := errors.New("test")
243
244 testAction := func(e *Event) error {
245 return testErr
246 }
247
248 scenarios := []struct {
249 route *Route[*Event]
250 expectMethod string
251 expectPath string
252 }{
253 {
254 group.Any("/test", testAction),
255 "",
256 "/test",
257 },
258 {
259 group.GET("/test", testAction),
260 http.MethodGet,
261 "/test",
262 },
263 {
264 group.SEARCH("/test", testAction),
265 "SEARCH",
266 "/test",
267 },
268 {
269 group.POST("/test", testAction),
270 http.MethodPost,
271 "/test",
272 },
273 {
274 group.DELETE("/test", testAction),
275 http.MethodDelete,
276 "/test",
277 },
278 {
279 group.PATCH("/test", testAction),
280 http.MethodPatch,
281 "/test",
282 },
283 {
284 group.PUT("/test", testAction),
285 http.MethodPut,
286 "/test",
287 },
288 {
289 group.HEAD("/test", testAction),
290 http.MethodHead,
291 "/test",
292 },
293 {
294 group.OPTIONS("/test", testAction),

Callers

nothing calls this directly

Calls 11

AnyMethod · 0.80
GETMethod · 0.80
SEARCHMethod · 0.80
POSTMethod · 0.80
DELETEMethod · 0.80
PATCHMethod · 0.80
PUTMethod · 0.80
HEADMethod · 0.80
OPTIONSMethod · 0.80
IsMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…