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. Under
useStrictMocks(), only those for the handler's context types.
interceptors
readonly interceptors: readonly InspectedInterceptor[]The interceptors around the handler, outermost first: global, class, then method interceptors. Under
useStrictMocks(), only those for the handler's context types, and none for an autocomplete.
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.
defer Since 4.3.0
readonly defer: Readonly<DeferOptions> | undefinedThe @Defer options the handler runs with, its own or those it inherits, with their defaults filled in: after
only for mode: 'auto'. undefined without @Defer, and for a message, reaction, event or autocomplete handler,
which @Defer doesn't apply to. A test reads it; toEqual doesn't compare it, so an assertion on the other fields
holds either way.
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. Under
useStrictMocks() it names an inherited @On or @Once event too, such as event "guildCreate"; default mode
leaves events out, with a warning once where it would name one. 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. Under useStrictMocks(),
only those whose types include the handler's.
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 |
|---|---|
metadata | MetadataDecorator<T> |
A decorator made by | |
Returns
T | undefinedThe value, or undefined when neither declares one.
Parameters
| Name | Type |
|---|---|
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 |
|---|---|
metadata | MetadataDecorator<T> |
A decorator made by | |
Returns
T[]The declared values; empty when none is declared.
Parameters
| Name | Type |
|---|---|
key | string | symbol |
The key | |
Returns
T[]The declared values; empty when none is declared.