Skip to content

Commit

Permalink
test(service): Enhance tests and log jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
HeneryHawk committed Jul 10, 2022
1 parent 545c6b2 commit 263fbd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/handlers/greeter.handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Handler, Req, OnRead, OnReject, AfterRead, Entities, Next, Data, Use, User } from "../../lib";
import { Handler, Req, OnRead, OnReject, AfterRead, Entities, Next, Data, Use, User, Jwt } from "../../lib";
import { HandlerMiddleware } from "../middlewares/handler.middleware";
import { IUser } from "../IUser";

Expand All @@ -17,8 +17,12 @@ export class GreeterHandler {
@Req() req: any,
@Next() next: Function,
@Data() data: IData,
@User() user: IUser
@User() user: IUser,
@Jwt() jwt: string
): Promise<IData[]> {
console.log("I am the ReadMiddleware");
console.log(`My jwt is ${jwt ? jwt : "empty"}`);

return [
{
Id: "8HEXDIG-4HEXDIG-4HEXDIG-4HEXDIG-12HEXDIG",
Expand Down
1 change: 1 addition & 0 deletions tests/middlewares/handler.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import { ICdsMiddleware, Middleware, Req, Jwt } from "../../lib";
export class HandlerMiddleware implements ICdsMiddleware {
public async use(@Req() req: any, @Jwt() jwt: string): Promise<void> {
console.log("I am a handler middleware");
console.log(`My jwt is ${jwt ? jwt : "empty"}`);
}
}

0 comments on commit 263fbd2

Please sign in to comment.