File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments