-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] Auth E2E 테스트 작성 #389
[BE] Auth E2E 테스트 작성 #389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오옷쓰 테스트 끝입니다.!! 😆
천천히 봐주세요!!
backend/src/auth/auth.controller.ts
Outdated
@@ -20,6 +21,7 @@ export class AuthController { | |||
} | |||
|
|||
@Get('refresh_token') | |||
@UseGuards(JwtAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에 refresh 토큰 발급 기능에서 토큰 없이 요청이 오는 경우 500 에러가 발생해 controller 진입 전 jwt토큰 유효성 검증을 하도록 변경했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 하면 이 API를 사용하는 일반적인 경우인,
jwt 토큰이 있지만 유효기한이 지난 경우에 가드에서 계속 막히지 않나요..?
서비스 로직에서 jwt가 없는 경우에 로그인 하도록 UnauthorizedException
을 보내도록 추가해도 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
가드는 삭제하고, 서비스 로직에서 체크하도록 변경했습니다
backend/test/auth/auth.e2e-spec.ts
Outdated
const response = await agent.post(url); | ||
|
||
//then | ||
expect(response.status).toEqual(201); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logout의 response status가 201로 오던데, 의도하신건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
호오.. 아니욥ㅋㅋㅋ
공식문서 찾아보니까 POST 요청인 경우에 응답코드가 기본으로 201이 되나 봅니다!
status code를 바꾸려면 @HttpCode
를 사용하면 되는 것 같은데 어떻게 할까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋네요!! 이걸로 200 코드를 반환하도록 변경했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
벌써 마지막 e2e라니... 수고 많으셨습니다! 👍🔥🔥
backend/src/auth/auth.controller.ts
Outdated
@@ -20,6 +21,7 @@ export class AuthController { | |||
} | |||
|
|||
@Get('refresh_token') | |||
@UseGuards(JwtAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 하면 이 API를 사용하는 일반적인 경우인,
jwt 토큰이 있지만 유효기한이 지난 경우에 가드에서 계속 막히지 않나요..?
서비스 로직에서 jwt가 없는 경우에 로그인 하도록 UnauthorizedException
을 보내도록 추가해도 좋을 것 같아요!
backend/test/auth/auth.e2e-spec.ts
Outdated
const response = await agent.post(url); | ||
|
||
//then | ||
expect(response.status).toEqual(201); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
호오.. 아니욥ㅋㅋㅋ
공식문서 찾아보니까 POST 요청인 경우에 응답코드가 기본으로 201이 되나 봅니다!
status code를 바꾸려면 @HttpCode
를 사용하면 되는 것 같은데 어떻게 할까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무 고생 많으셨습니다!!
성불 축하드립니다 😂🔥🔥
이슈 번호
#382
완료한 기능 명세