-
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.
- Loading branch information
Kisun Park
committed
Apr 2, 2024
1 parent
418c927
commit 1b0c1e8
Showing
3 changed files
with
178 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,52 @@ | ||
import Page from '../src/app/page'; | ||
import { OwnerButtonLayer } from '@/component/Personal'; | ||
import { themeObj } from '@/types/theme'; | ||
import '@testing-library/jest-dom'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
describe('Page', () => { | ||
it('renders a heading', () => { | ||
render(<Page />); | ||
describe('OwnerButtonLayer 컴포넌트 테스트', () => { | ||
it('isEdit가 false일 때 편집, 공유하기, 글쓰기 버튼이 정상적으로 렌더링되는지 확인', () => { | ||
render( | ||
<OwnerButtonLayer | ||
handleClickEdit={() => {}} | ||
handleClickShare={() => {}} | ||
handleClickWrite={() => {}} | ||
theme={themeObj.chris} | ||
isEdit={false} | ||
handleClickDelete={() => {}} | ||
/>, | ||
); | ||
|
||
const heading = screen.getByRole('heading', { level: 1 }); | ||
// "편집" 버튼을 기준으로 컴포넌트가 렌더링되었는지 확인합니다. | ||
const editButton = screen.getByRole('button', { name: '편집' }); | ||
expect(editButton).toBeInTheDocument(); | ||
|
||
expect(heading).toBeInTheDocument(); | ||
// "공유하기" 버튼이 렌더링되었는지 확인합니다. | ||
const shareButton = screen.getByRole('button', { name: '공유하기' }); | ||
expect(shareButton).toBeInTheDocument(); | ||
|
||
// "글쓰기" 버튼이 렌더링되었는지 확인합니다. | ||
const writeButton = screen.getByRole('button', { name: '글쓰기' }); | ||
expect(writeButton).toBeInTheDocument(); | ||
}); | ||
|
||
it('isEdit가 true일 때 "선택 삭제" 및 "취소" 버튼이 정상적으로 렌더링되는지 확인', () => { | ||
render( | ||
<OwnerButtonLayer | ||
handleClickEdit={() => {}} | ||
handleClickShare={() => {}} | ||
handleClickWrite={() => {}} | ||
theme={themeObj.chris} | ||
isEdit={true} | ||
handleClickDelete={() => {}} | ||
/>, | ||
); | ||
|
||
// "선택 삭제" 버튼을 기준으로 컴포넌트가 렌더링되었는지 확인합니다. | ||
const deleteButton = screen.getByRole('button', { name: '선택 삭제' }); | ||
expect(deleteButton).toBeInTheDocument(); | ||
|
||
// "취소" 버튼이 렌더링되었는지 확인합니다. | ||
const cancelButton = screen.getByRole('button', { name: '취소' }); | ||
expect(cancelButton).toBeInTheDocument(); | ||
}); | ||
}); |
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