Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to test an Imgix image with Jest #923

Open
reemobeid17 opened this issue Sep 18, 2023 · 0 comments
Open

Not able to test an Imgix image with Jest #923

reemobeid17 opened this issue Sep 18, 2023 · 0 comments

Comments

@reemobeid17
Copy link

reemobeid17 commented Sep 18, 2023

Describe the bug
I'm trying to write a Jest unit test for one of my components that is rendering an Imgix image. The test is breaking with this error TypeError: Cannot read properties of undefined (reading 'split')

To Reproduce
Run a test that renders an Imgix component render(<Imgix src="https://www.google.com/image-url" htmlAttributes={{ alt: "Image alt" }} />) using @testing-library/react

and then test

  await waitFor(() => {
      const imgElement = getByAltText("Image alt");
      expect(imgElement).toBeInTheDocument();
  });

Expected behaviour
Expect the test to succeed and image tag to be part of the document when testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant