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

Add ability to simulate a feature flag change event #53

Open
Chase-Dickerson opened this issue Mar 9, 2023 · 1 comment
Open

Add ability to simulate a feature flag change event #53

Chase-Dickerson opened this issue Mar 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Chase-Dickerson
Copy link

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!

@Chase-Dickerson 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
@yusinto yusinto added the enhancement New feature or request label Mar 23, 2023
@yusinto
Copy link
Collaborator

yusinto commented Mar 23, 2023

Thank you for your submission. This has been filed internally as 194027 and we will discuss it.

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

No branches or pull requests

2 participants