You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a scenario where a user of our UI gets redirected when a feature flag is changed -- for example, turning on our "maintenance" flag redirects the user to a maintenance screen and doesn't allow anyone access to the site until the maintenance flag is turned back off. I can test what the user sees when the flag is off, what they see when the flag is on, but I cannot test the transition the user experiences when that flag changes while they are on the website.
Describe the solution you'd like
I would like to have a way to simulate a ldClient.on('change') event in a Jest test. We are using launchdarkly-react-client-sdk, so the desired event change would trigger a component re-render, which would be detectable by our test.
Describe alternatives you've considered
Our team was previously using launchdarkly-js-client-sdk directly, and we were able to simulate the change in jest with that library by setting up a tricky workaround / callback behavior and manually updating the flags when they changed. With launchdarkly-react-client-sdk, we are only utilizing the "useFlags" hook now.
Thanks for considering some solution to this!
The text was updated successfully, but these errors were encountered:
Chase-Dickerson
changed the title
Ability to simulate a feature flag change event
Add ability to simulate a feature flag change event
Mar 9, 2023
Is your feature request related to a problem? Please describe.
I have a scenario where a user of our UI gets redirected when a feature flag is changed -- for example, turning on our "maintenance" flag redirects the user to a maintenance screen and doesn't allow anyone access to the site until the maintenance flag is turned back off. I can test what the user sees when the flag is off, what they see when the flag is on, but I cannot test the transition the user experiences when that flag changes while they are on the website.
Describe the solution you'd like
I would like to have a way to simulate a ldClient.on('change') event in a Jest test. We are using launchdarkly-react-client-sdk, so the desired event change would trigger a component re-render, which would be detectable by our test.
Describe alternatives you've considered
Our team was previously using launchdarkly-js-client-sdk directly, and we were able to simulate the change in jest with that library by setting up a tricky workaround / callback behavior and manually updating the flags when they changed. With launchdarkly-react-client-sdk, we are only utilizing the "useFlags" hook now.
Thanks for considering some solution to this!
The text was updated successfully, but these errors were encountered: