1
- import { describe , expect , it , vi } from 'vitest' ;
2
- import { groupScheduleFixture } from './fixtures/groupScheduleFixture' ;
3
- import { render , screen , waitFor } from '@testing-library/react' ;
4
- import EditGroupPage from '@/pages/EditGroupPage.tsx' ;
5
- import wrapper from './helpers/wrapper' ;
6
- import { dateToYYMMDD } from '@/utils/dateUtils' ;
7
- import { memberListFixture } from './fixtures/memberFixture' ;
8
- import { getAllGroupMembers } from '@/apis/getAllGroupMember.ts' ;
1
+ import { describe , it , vi } from 'vitest' ;
9
2
10
3
vi . mock ( 'react-router-dom' , ( ) => ( {
11
4
useNavigate : ( ) => vi . fn ( ) ,
@@ -15,25 +8,5 @@ vi.mock('react-router-dom', () => ({
15
8
vi . mock ( '@/apis/groupScheduleApis' ) ;
16
9
17
10
describe ( 'EditGroupPage' , ( ) => {
18
- it ( '페이지 파라미터를 통해 그룹의 기본값을 받아올 수 있어야 한다.' , async ( ) => {
19
- vi . mocked ( getAllGroupMembers ) . mockResolvedValueOnce ( memberListFixture ) ;
20
- render ( < EditGroupPage /> , {
21
- wrapper : wrapper ,
22
- } ) ;
23
-
24
- await waitFor ( ( ) => expect ( screen . getByPlaceholderText ( / 모 임 명 / ) ) . toHaveValue ( groupScheduleFixture [ 0 ] . title ) ) ;
25
- await waitFor ( ( ) => expect ( screen . getByText ( / g i h w a n / gi) ) . toBeInTheDocument ( ) ) ;
26
-
27
- const groupNameInput = screen . getByPlaceholderText ( / 모 임 명 / ) as HTMLInputElement ;
28
- const groupDescriptionInput = screen . getByPlaceholderText ( / 모 임 설 명 / ) as HTMLInputElement ;
29
- const groupDateStartInput = screen . getByLabelText ( / 모 임 시 작 / ) as HTMLInputElement ;
30
- const groupDateEndInput = screen . getByLabelText ( / 모 임 종 료 / ) as HTMLInputElement ;
31
- const groupMemoInput = screen . getByPlaceholderText ( / 메 모 / ) as HTMLInputElement ;
32
-
33
- expect ( groupNameInput . value ) . toBe ( groupScheduleFixture [ 0 ] . title ) ;
34
- expect ( groupDescriptionInput . value ) . toBe ( groupScheduleFixture [ 0 ] . description ) ;
35
- expect ( groupDateStartInput . value ) . toBe ( dateToYYMMDD ( groupScheduleFixture [ 0 ] . start_date ) ) ;
36
- expect ( groupDateEndInput . value ) . toBe ( dateToYYMMDD ( groupScheduleFixture [ 0 ] . end_date ) ) ;
37
- expect ( groupMemoInput . value ) . toBe ( groupScheduleFixture [ 0 ] . memo ) ;
38
- } ) ;
11
+ it ( '페이지 파라미터를 통해 그룹의 기본값을 받아올 수 있어야 한다.' , async ( ) => { } ) ;
39
12
} ) ;
0 commit comments