MCPcopy Create free account
hub / github.com/ankorstore/yokai / TestMiddlewareRegistration

Function TestMiddlewareRegistration

fxhttpserver/register_test.go:12–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestMiddlewareRegistration(t *testing.T) {
13 t.Parallel()
14
15 type exampleMiddleware struct {
16 name string
17 }
18
19 mw := exampleMiddleware{name: "test"}
20
21 tests := []struct {
22 middleware any
23 kind fxhttpserver.MiddlewareKind
24 }{
25 {mw, fxhttpserver.GlobalUse},
26 {mw, fxhttpserver.GlobalPre},
27 {mw, fxhttpserver.Attached},
28 }
29
30 for _, tt := range tests {
31 tt := tt
32
33 t.Run(tt.kind.String(), func(t *testing.T) {
34 t.Parallel()
35
36 mr := fxhttpserver.NewMiddlewareRegistration(tt.middleware, tt.kind)
37
38 assert.Equal(t, tt.middleware, mr.Middleware())
39 assert.Equal(t, tt.kind, mr.Kind())
40 })
41 }
42}
43
44func TestHandlerRegistration(t *testing.T) {
45 t.Parallel()

Callers

nothing calls this directly

Calls 4

MiddlewareMethod · 0.95
KindMethod · 0.95
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected