(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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 | |
| 44 | func TestHandlerRegistration(t *testing.T) { |
| 45 | t.Parallel() |
nothing calls this directly
no test coverage detected