Skip to content

Commit

Permalink
style: 불필요한 log제거 및 오타수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JangAJang committed Nov 21, 2023
1 parent 9685bb8 commit 6224d32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions BE/src/question/controller/question.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ import { Question } from '../entity/question';
import { Category } from '../../category/entity/category';
import { CreateQuestionRequest } from '../dto/createQuestionRequest';
import * as cookieParser from 'cookie-parser';
import { QuestionResponseList } from '../dto/questionResponseList';

describe('QuestionController', () => {
let controller: QuestionController;
const mockQuestionService = {
createQuestion: jest.fn(),
findAllByCategory: jest.fn(),
};
const mockTokenService = {};

Expand Down Expand Up @@ -68,6 +70,19 @@ describe('QuestionController', () => {
),
).resolves.toEqual(QuestionResponse.from(questionFixture));
});

it('조회시 QuestionResponseList객체를 반환한다.', async () => {
//given

//when
mockQuestionService.findAllByCategory.mockResolvedValue([
QuestionResponse.from(questionFixture),
]);
//then
await expect(controller.findCategoryQuestions(1)).resolves.toEqual(
QuestionResponseList.of([QuestionResponse.from(questionFixture)]),
);
});
});

describe('QuestionController 통합테스트', () => {
Expand Down
2 changes: 1 addition & 1 deletion BE/src/question/exception/question.exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ContentNotFoundException extends HttpException {

class NeedToFindByCategoryIdException extends HttpException {
constructor() {
super('카테고리 id를 입력해주세요 합니다.', 400);
super('카테고리 id를 입력해주세요.', 400);
}
}

Expand Down
1 change: 0 additions & 1 deletion BE/src/token/strategy/access.token.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class AccessTokenStrategy extends PassportStrategy(Strategy, 'jwt') {
}

async validate(payload: TokenPayload) {
console.log(`토큰 파싱 결과 : ${payload}`);
const id = payload.id;
const user = await this.memberRepository.findById(id);
if (!user) throw new InvalidTokenException(); // 회원이 조회가 되지 않았다면, 탈퇴한 회원의 token을 사용한 것이므로 유효하지 않은 토큰을 사용한 것임
Expand Down

0 comments on commit 6224d32

Please sign in to comment.