-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change target grade-upload test
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 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,18 +1,30 @@ | ||
import UploadPdf from '@/app/ui/view/molecule/upload-pdf/upload-pdf'; | ||
import { render, screen } from '@testing-library/react'; | ||
import fireEvent from '@testing-library/user-event'; | ||
import { userEvent } from '@testing-library/user-event'; | ||
|
||
describe('성적 업로드', () => { | ||
it('pdf가 아닌 파일을 업로드할 수 없다', async () => { | ||
it('파일이 업로드 될 때, pdf file을 업로드 하면 file명이 노출된다.', async () => { | ||
render(<UploadPdf />); | ||
|
||
const targetFile = new File(['grade'], 'grade.pdf', { | ||
type: 'text/plain', | ||
}); | ||
|
||
const uploadBox = await screen.findByTestId('upload-box'); | ||
fireEvent.upload(uploadBox, targetFile); | ||
await userEvent.upload(uploadBox, targetFile); | ||
|
||
expect(screen.queryByText('추가')).not.toBeInTheDocument(); | ||
expect(screen.getByText(targetFile.name)).toBeInTheDocument(); | ||
}); | ||
|
||
it('파일이 업로드 될 때, pdf가 아닌 file을 업로드 하면 변화가 발생하지않는다.', async () => { | ||
render(<UploadPdf />); | ||
|
||
const targetFile = new File(['grade'], 'grade.png', { | ||
type: 'text/plain', | ||
}); | ||
|
||
const uploadBox = await screen.findByTestId('upload-box'); | ||
await userEvent.upload(uploadBox, targetFile); | ||
expect(screen.queryByText('마우스로 드래그 하거나 아이콘을 눌러 추가해주세요.')).toBeInTheDocument(); | ||
}); | ||
}); |