Skip to content

Commit 8c9ca23

Browse files
committed
LoginPage에 이메일, 비밀번호, 로그인 버튼이 있는지 테스트합니다
1 parent bb9bb2b commit 8c9ca23

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/LoginPage.test.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { MemoryRouter } from 'react-router-dom';
2+
3+
import { render } from '@testing-library/react';
4+
5+
import LoginPage from './LoginPage';
6+
7+
describe('LoginPage', () => {
8+
const renderLoginPage = () => render(
9+
<LoginPage />,
10+
);
11+
12+
it('페이지 제목이 있다.', () => {
13+
const { getByRole } = renderLoginPage();
14+
15+
expect(getByRole('heading', { level: 2 })).toHaveTextContent('Login');
16+
});
17+
18+
it('아이디와 비밀번호를 입력할 수 있는 input과 버튼이 있다.', () => {
19+
const { getByRole, getAllByRole } = renderLoginPage();
20+
21+
expect(getAllByRole('textbox')).toHaveLength(2);
22+
expect(getByRole('textbox', { name: 'E-mail' })).toBeInTheDocument();
23+
expect(getByRole('textbox', { name: 'Password' })).toBeInTheDocument();
24+
expect(getByRole('button', { name: 'Log in' })).toBeInTheDocument();
25+
});
26+
});

0 commit comments

Comments
 (0)