Skip to content

Commit

Permalink
Refactor: test 코드 로직 수정, 주석 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
hwinkr committed Apr 9, 2023
1 parent 48394df commit 663c884
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/components/Card/InformCard/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { MemoryRouter } from 'react-router-dom';
import '@testing-library/jest-dom';
import InformCard from './index';

// 3. memoryRouter, 가상 라우터

describe('Card 클릭 시 페이지 이동이 잘 되는지에 대한 테스트', () => {
it('공지사항 클릭 테스트', () => {
const ICON = 'notification';
Expand All @@ -22,10 +20,12 @@ describe('Card 클릭 시 페이지 이동이 잘 되는지에 대한 테스트'

const card = screen.getByTestId('card');

userEvent.click(card);
waitFor(() => {
expect(window.location.pathname).toBe(`/${PATH}`);
});
(async () => {
await userEvent.click(card);
waitFor(() => {
expect(window.location.pathname).toBe(`/${PATH}`);
});
})();
});

it('졸업요건 클릭 테스트', () => {
Expand All @@ -41,9 +41,11 @@ describe('Card 클릭 시 페이지 이동이 잘 되는지에 대한 테스트'

const card = screen.getByTestId('card');

userEvent.click(card);
waitFor(() => {
expect(window.location.pathname).toBe(`/${PATH}`);
});
(async () => {
await userEvent.click(card);
waitFor(() => {
expect(window.location.pathname).toBe(`/${PATH}`);
});
})();
});
});

0 comments on commit 663c884

Please sign in to comment.