Skip to content

Commit

Permalink
fix(di): fix intercept stored token on context.target
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Dec 13, 2024
1 parent 53a5140 commit 8f407cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/di/src/common/decorators/intercept.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/di/src/common/decorators/intercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function bindIntercept(target: any, propertyKey: string | symbol, token:
};

const context: InterceptorContext<any> = {
target,
target: klass,
propertyKey,
args,
options,
Expand Down

0 comments on commit 8f407cb

Please sign in to comment.