Skip to content
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

7-3, 10-1 [BE] 논문 검색 테스트 코드 작성, 키워드 검색 API 작성 #43

Merged
merged 9 commits into from
Nov 22, 2022

Conversation

leesungbin
Copy link
Member

@leesungbin leesungbin commented Nov 21, 2022

개요

논문 검색과 관련한 테스트 코드, 키워드 검색 기능이 추가되었습니다.

작업사항

  • /search 로직 작성
  • /search/auto-complete/search 에 대한 테스트코드 작성
  • /search/search/auto-complete 는 crossref에 요청하는 쿼리만 다르고 그 외에는 동일하게 작동합니다.
  • 따라서, 기존에 작성한 auto-complete의 로직을 최대한 재활용하였습니다.
  • search.controller.spec.ts 에서는, axios get 요청에 대해 가짜 함수를 implement하여 사용합니다.
    • crossref api가 적절한 시간안에 항상 성공한다는 가정이 담겨야했던 부분입니다.
    • 추후에, api 요청 시간에 따른 timeout / 요청 자체가 실패할 경우에 대한 함수도 비슷하게 작성할 예정입니다.
  • package.json 은 jest timeout을 추가하면서 tab이 space로 변경되었습니다.

리뷰 요청사항

  • /search 로직
  • /search 에서 추가적으로 테스트가 필요하거나, 변경되었으면 좋겠는 부분

@leesungbin leesungbin marked this pull request as ready for review November 21, 2022 09:55
backend/src/search/tests/search.controller.spec.ts Outdated Show resolved Hide resolved
backend/src/search/tests/search.controller.spec.ts Outdated Show resolved Hide resolved
backend/src/search/tests/search.pipe.spec.ts Outdated Show resolved Hide resolved
backend/src/search/tests/search.pipe.spec.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@Palwol Palwol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트코드 잘 봤습니다. 테스트코드를 통해 점점 더 상세한 예외처리가 되가고 있는 것 같네요. 👍

API 테스트의 경우 테스트 명을 API 명세 예시처럼 작성해주셨는데, 이렇게 하니 어떤 API 메소드를 테스트하는지는 잘 보이지만 어떤 예외를 테스트하는건지, 어떤 경우의 어떤 결과를 기대하고 테스트하는건지는 알기는 조금 어려운 것 같습니다.

개인적으로는 (GET) keyword 미포함 - /search/auto-complete?keyword=와 같이 어떤 경우를 테스트하는 것인지 설명을 덧붙였을 때 이해가 더 쉬웠습니다!

backend/src/search/search.service.ts Outdated Show resolved Hide resolved
backend/src/tests/search.controller.e2e.spec.ts Outdated Show resolved Hide resolved
@leesungbin leesungbin linked an issue Nov 22, 2022 that may be closed by this pull request
@leesungbin leesungbin merged commit be9abc5 into dev Nov 22, 2022
@leesungbin leesungbin deleted the feature/search-test branch November 22, 2022 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FE, BE] authors가 빈배열로 리턴되는 에러
4 participants