launchdarkly / jest-launchdarkly-mock

Easily unit test LaunchDarkly feature flagged components with jest
Apache License 2.0
25 stars 19 forks source link

withLDConsumer doesn't mock flags #33

Open gorgias-botond-dombi opened 2 years ago

gorgias-botond-dombi commented 2 years ago

Is your feature request related to a problem? Please describe. The flags will never be mocked when using withLDConsumer for a class component. It will only be mocked for the hook useFlags. https://github.com/launchdarkly/jest-launchdarkly-mock/blob/e509cc7febb427a6f2576a20d8fde3be3a045f6a/src/index.ts#L55 vs https://github.com/launchdarkly/jest-launchdarkly-mock/blob/e509cc7febb427a6f2576a20d8fde3be3a045f6a/src/index.ts#L58-L72 Describe the solution you'd like The withLDConsumer should be passing the mocked flags object as a prop, to the rendered component.

carmenquan commented 2 years ago

Thanks @gorgias-botond-dombi for reporting this issue. I'll follow up with our team and get back to you!

sangeethsivanb commented 4 months ago

Hi @carmenquan , apologies for following up on this old thread. Do you have any updates on this? Thanks!

Hi @gorgias-botond-dombi , have you found any workarounds or solutions to this issue? Thanks!