HandlerInspection
interface in meocord/testing Since 4.1.0
interface HandlerInspectionWhat runs for one handler, and the metadata declared on it, as inspectHandler reports it.
Members
controller
readonly controller: new (...args: any[]) => unknownThe controller class declaring the handler.
methodName
readonly methodName: stringThe handler method's name.
guards
readonly guards: readonly InspectedGuard[]The guards that run before the handler, in order: global guards, class guards, then method guards.
interceptors
readonly interceptors: readonly InspectedInterceptor[]The interceptors around the handler, outermost first: global, class, then method interceptors.
filters
readonly filters: readonly InspectedFilter[]The exception filters for the handler, in the order they are tried: the method's, then the controller's, then global ones.
cooldowns
readonly cooldowns: readonly InspectedCooldown[]The handler's cooldowns, the controller's first, with their defaults filled in.
pattern
readonly pattern: string | undefinedThe @MessageHandler pattern, or undefined for a listener and for any other kind of handler.
inheritedRoutes Since 4.2.0
readonly inheritedRoutes: readonly string[]The routes the handler answers because a class its controller extends declares them, such as slash "ping":
those its own class doesn't declare for it. Empty for a handler that declares all it answers. A test reads it;
toEqual doesn't compare it, so an assertion on the other fields holds either way.
observers
readonly observers: readonly (new (...args: any[]) => DispatchObserver)[]The app's observers, in the order they are told about the call; empty without an app.
get
get<T>(metadata: MetadataDecorator<T>): T | undefined
get<T = unknown>(key: string | symbol): T | undefinedReads a metadata value as ExecutionContext.get does: the method's value, else the controller's.
Parameters
| Name | Type | Description |
|---|---|---|
metadata | MetadataDecorator<T> | A decorator made by |
Returns
T | undefinedThe value, or undefined when neither declares one.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | symbol | The key |
Returns
T | undefinedThe value, or undefined when neither declares one.
getAll
getAll<T>(metadata: MetadataDecorator<T>): T[]
getAll<T = unknown>(key: string | symbol): T[]Reads every declared value as ExecutionContext.getAll does, method first, then controller.
Parameters
| Name | Type | Description |
|---|---|---|
metadata | MetadataDecorator<T> | A decorator made by |
Returns
T[]The declared values; empty when none is declared.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | symbol | The key |
Returns
T[]The declared values; empty when none is declared.