diff --git a/packages/di/src/common/decorators/intercept.spec.ts b/packages/di/src/common/decorators/intercept.spec.ts index 0307b836140..01b63a7cebe 100644 --- a/packages/di/src/common/decorators/intercept.spec.ts +++ b/packages/di/src/common/decorators/intercept.spec.ts @@ -1,4 +1,4 @@ -import {catchError} from "@tsed/core"; +import {catchError, classOf, nameOf} from "@tsed/core"; import {DITest} from "../../node/index.js"; import {InterceptorContext} from "../interfaces/InterceptorContext.js"; @@ -13,6 +13,8 @@ class MyInterceptor implements InterceptorMethods { const r = typeof context.args[0] === "string" ? undefined : new Error(`Error message`); const retValue = context.next(r); + expect(nameOf(context.target)).toContain("Service"); + return `${retValue} - ${context.options || ""} - intercepted 1`; } } diff --git a/packages/di/src/common/decorators/intercept.ts b/packages/di/src/common/decorators/intercept.ts index abd6cd0036c..e7d98c382a0 100644 --- a/packages/di/src/common/decorators/intercept.ts +++ b/packages/di/src/common/decorators/intercept.ts @@ -29,7 +29,7 @@ export function bindIntercept(target: any, propertyKey: string | symbol, token: }; const context: InterceptorContext = { - target, + target: klass, propertyKey, args, options,