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

Fix: 학부/학과와 전공 모두 있는경우 전공만 저장하도록 수정 #110

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

pp449
Copy link
Member

@pp449 pp449 commented Jul 26, 2023

🤠 개요

  • closes: Fix: 테스트 에러 해결 #109
  • 학부/학과와 전공 모두 있는경우 전공만 저장하도록 수정했어요
  • 테스트코드의 경우 모달창에 확인을 누른경우 함수가 실행되어야는데 모달(useModals)을 모킹했기 때문에 테스트가 안되어 skip으로 바꿨어요!

💫 설명

📷 스크린샷 (Optional)

@pp449 pp449 added the 🛠 fix label Jul 26, 2023
@pp449 pp449 self-assigned this Jul 26, 2023
Copy link
Collaborator

@hwinkr hwinkr left a comment

Choose a reason for hiding this comment

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

✅ LGTM

@@ -107,7 +107,7 @@ describe('학과선택 테스트', () => {
});
});

it('학과 이름에 스페이스가 있는 경우 (학부, 전공이 모두 있는경우) 테스트', async () => {
it.skip('학과 이름에 스페이스가 있는 경우 (학부, 전공이 모두 있는경우) 테스트', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

  it('학과 이름에 스페이스가 있는 경우 (학부, 전공이 모두 있는경우) 테스트', async () => {
    const collegName = '정보융합대학';
    render(
      <MemoryRouter initialEntries={[`/major-decision/${collegName}`]}>
        <Routes>
          <Route path="/major-decision/:college" element={<DepartmentList />} />
        </Routes>
      </MemoryRouter>,
    );

    const confirmButton = await screen.findByRole('button', {
      name: '선택완료',
    });
    const college = await screen.findByText('조형학부 건축학전공');
    await act(async () => {
      await userEvent.click(college);
    });
    await userEvent.click(confirmButton);

    expect(useModals().openModal).toHaveBeenCalledWith(ConfirmModal, {
      message: MODAL_MESSAGE.CONFIRM.SET_MAJOR,
      onCancelButtonClick: expect.any(Function),
      onConfirmButtonClick: expect.any(Function),
    });

    const confirmMessage = screen.queryByText(MODAL_MESSAGE.CONFIRM.SET_MAJOR);
    if (confirmMessage) {
      expect(confirmMessage.textContent).toBe(MODAL_MESSAGE.CONFIRM.SET_MAJOR);

      await act(async () => {
        await userEvent.click(confirmMessage);
      });

      expect(useModals().openModal).toHaveBeenCalledWith(AlertModal, {
        message: MODAL_MESSAGE.SUCCEED.SET_MAJOR,
        buttonMessage: '홈으로 이동하기',
        onClose: () => expect.any(Function),
        routerTo: () => expect.any(Function),
      });
    }
  });

이렇게 하니까 통과가 되네요~!
수정 부탁드려요!

Copy link
Member Author

Choose a reason for hiding this comment

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

이 테스트는 학과 이름이 '조형학부 건축학전공' 인 경우 '건축학전공' 으로 선택되는지 확인하는 테스트라서 테스트 명제랑 내용이 맞지 않는거 같아요!

Copy link
Collaborator

@hwinkr hwinkr left a comment

Choose a reason for hiding this comment

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

흠...계속 통과하도록 수정해보고 있는데 잘 안되네여..일단 skip 합시다

@hwinkr
Copy link
Collaborator

hwinkr commented Jul 31, 2023

merge 부탁드려요~

@pp449 pp449 merged commit bc44e24 into dev Jul 31, 2023
1 check passed
@pp449 pp449 deleted the fix/#109 branch July 31, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: 테스트 에러 해결
2 participants