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

[BE] 27.07 주식 detail 페이지 서비스 테스트 코드 작성 #237 #248

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

uuuo3o
Copy link
Collaborator

@uuuo3o uuuo3o commented Dec 2, 2024

✅ 주요 작업

  • 특정 주식의 현재가 체결 데이터 테스트
  • 특정 주식의 차트 데이터 테스트

💭 고민과 해결과정

  • repository에서 특정 종목 코드를 입력해서 값을 가져오는 과정을 처음에 헤맸었다.
    jest
      .spyOn(stockDetailRepository, 'findOneByCode')
      .mockImplementation((code: string) => {
        const stock = new Stocks();
        stock.code = code;
        stock.name = '삼성전자';
        stock.market = 'KOSPI';

        return Promise.resolve(stock);
      });

@uuuo3o uuuo3o requested review from jinddings and sieunie December 2, 2024 12:05
@uuuo3o uuuo3o self-assigned this Dec 2, 2024
@uuuo3o uuuo3o added BE 백엔드 TEST 테스트 코드 작성 API API 구현 labels Dec 2, 2024
@uuuo3o uuuo3o linked an issue Dec 2, 2024 that may be closed by this pull request
Copy link
Collaborator

@sieunie sieunie left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다!

Comment on lines +42 to +51
jest
.spyOn(stockDetailRepository, 'findOneByCode')
.mockImplementation((code: string) => {
const stock = new Stocks();
stock.code = code;
stock.name = '삼성전자';
stock.market = 'KOSPI';

return Promise.resolve(stock);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

🟢 저는 이런 부분들 그냥 mockResolvedValue로 오브젝트를 던져줬었는데 진님 방식도 좋은 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

그냥 한번 여러 방식으로 해보고 싶었어요..ㅎㅎㅎㅎ mockResolvedValue가 간단해서 편하긴 한 거 같아용ㅎㅋㅋㅋㅋ

@uuuo3o uuuo3o merged commit 0a72a7a into back/main Dec 3, 2024
2 checks passed
@uuuo3o uuuo3o deleted the test/stockDetail-#237 branch December 5, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API 구현 BE 백엔드 TEST 테스트 코드 작성
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] 27.07 백엔드 테스트 코드 작성
2 participants