Skip to content

Commit

Permalink
Test(Home): 홈 페이지 렌더링 텍스트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hwinkr committed Feb 5, 2024
1 parent 4ee89a8 commit 75e79c8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/pages/Home/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import '@testing-library/jest-dom';

import Home from './index';

interface TextInScreen {
[key: string]: string;
}

describe('Home Page 컴포넌트 테스트', () => {
it('페이지에 공지사항 및 졸업요건 컴포넌트가 렌더링된다.', () => {
render(
Expand All @@ -18,10 +22,16 @@ describe('Home Page 컴포넌트 테스트', () => {
wrapper: MemoryRouter,
},
);
const notificationText = screen.getByText('학교 공지사항');
expect(notificationText).toBeInTheDocument();

const requirementText = screen.getByText('졸업요건');
expect(requirementText).toBeInTheDocument();
const EXPECTED_TEXT: TextInScreen = {
school: '학교 공지사항 보러가기',
major: '학과 공지사항 보러가기',
graduation: '졸업요건 보러가기',
};

Object.keys(EXPECTED_TEXT).forEach((key) => {
const expectedText = screen.getByText(EXPECTED_TEXT[key]);
expect(expectedText).toBeInTheDocument();
});
});
});

0 comments on commit 75e79c8

Please sign in to comment.