Testing Joyride using React-Testing-Library? #821
-
Thank you for this awesome library, I'm using react-joyride in a project of mine. We're unit-testing the application using RTL. I would like to introduce unit-tests to ensure that in a specific state the react-joyride popups are visible - however when I render the component with RTL I get an error:
digging a bit deeper into the error, it seems to be occurring inside react-floater.js in node_modules - the console also starts to print the lib file. Question: Is there some specific setup that needs to happen to test Joyride with RTL? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
hey @astrosuf This library needs a browser environment to work properly, and I don't think the JSDOM environment inside jest will do. Anyway, react-floater uses RTL for its tests, so it does work. |
Beta Was this translation helpful? Give feedback.
hey @astrosuf
This library needs a browser environment to work properly, and I don't think the JSDOM environment inside jest will do.
Anyway, you will need to change jest's testEnvironment to
dom
and probably mock some functionality.Anyway, react-floater uses RTL for its tests, so it does work.