[TDD] input file upload test

승미니·2023년 1월 5일
0

TDD

목록 보기
1/1
  test("파일이 업로드 되었나요?", () => {
    render(<Component />);
    const input = screen.getByTestId("upload-input")
    const file = new File([new Blob()], 'image.jpeg', {
      type: 'image/jpeg',
    });
    userEvent.upload(input, file)
    expect(screen.getByTestId("file-name")).toBeVisible()
  })

개인적으로 이 부분이 헷갈려서 기록해두고 싶었다 !

    const file = new File([new Blob()], 'image.jpeg', {
      type: 'image/jpeg',
    });
    userEvent.upload(input, file)
profile
Web Frontend Developer

0개의 댓글