-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FE] test: LandingPage에서 사용하는 API에 대한 테스트 작성 (#251)
* chore: 불필요한 Fragment 제거 * test: LandingPage에서 사용하는 api 테스트 추가
- Loading branch information
Showing
4 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
frontend/src/pages/LandingPage/components/ReviewAccessForm/reviewAccessForm.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getIsValidGroupAccessCodeApi } from '@/apis/group'; | ||
|
||
describe('getIsValidGroupAccessCodeApi', () => { | ||
it('유효한 확인 코드인 경우 유효성 여부를 참으로 반환한다', async () => { | ||
const validGroupAccessCode = 'group20'; | ||
|
||
const isValid = await getIsValidGroupAccessCodeApi(validGroupAccessCode); | ||
|
||
expect(isValid).toBe(true); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
frontend/src/pages/LandingPage/queries/usePostDataForURL.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { renderHook, act, waitFor } from '@testing-library/react'; | ||
|
||
import QueryClientWrapper from '@/queryTestSetup/QueryClientWrapper'; | ||
|
||
import { CREATED_GROUP_DATA } from './../../../mocks/mockData/group'; | ||
import usePostDataForURL from './usePostDataForURL'; | ||
|
||
describe('usePostDataForURL', () => { | ||
it('URL 및 확인 코드를 발급받을 수 있다.', async () => { | ||
// given | ||
const dataForURL = { | ||
revieweeName: 'ollie', | ||
projectName: 'review-me', | ||
}; | ||
|
||
const { result } = renderHook(() => usePostDataForURL(), { wrapper: QueryClientWrapper }); | ||
|
||
// when | ||
act(() => { | ||
result.current.mutate(dataForURL); | ||
}); | ||
|
||
await waitFor(() => expect(result.current.isSuccess).toBe(true)); | ||
|
||
// then | ||
expect(result.current.data).toEqual(CREATED_GROUP_DATA); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters