-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from kdt-8-4/156-testCode
[Test] #156 카테고리 검색 기능(통합) 테스트 구현, Given-When-Then 구조 재설정, 해시태그 검색 통합 테스트 수정
- Loading branch information
Showing
8 changed files
with
333 additions
and
59 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
25 changes: 25 additions & 0 deletions
25
weatherfit_refactoring/src/Components/Molecules/FeedCategory.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,25 @@ | ||
import { render, screen, waitFor } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event' | ||
import FeedCategory from './FeedCategory' | ||
|
||
//카테고리 선택창 Mocking | ||
|
||
jest.mock('./post/FeedCategorySelect', () => { | ||
return () => <div>카테고리 선택창</div> | ||
}) | ||
|
||
describe('FeedCategory 컴포넌트 유닛 테스트', () => { | ||
test('카테고리 버튼을 클릭했을 때, 카테고리 선택창이 나타나는지 확인한다.', async () => { | ||
// Given | ||
render(<FeedCategory />) | ||
|
||
// When | ||
const categoryButton = screen.getAllByRole('button')[0] | ||
userEvent.click(categoryButton) | ||
|
||
// Then | ||
await waitFor(() => { | ||
expect(screen.getByText('카테고리 선택창')).toBeInTheDocument() | ||
}) | ||
}) | ||
}) |
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
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
Oops, something went wrong.