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

withLDConsumer doesn't mock flags #33

Open
gorgias-botond-dombi opened this issue Aug 29, 2022 · 2 comments
Open

withLDConsumer doesn't mock flags #33

gorgias-botond-dombi opened this issue Aug 29, 2022 · 2 comments

Comments

@gorgias-botond-dombi
Copy link

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.

mockWithLDConsumer.mockImplementation(() => (children: any) => children)

vs
export const mockFlags = (flags: LDFlagSet) => {
mockUseFlags.mockImplementation(() => {
const result: LDFlagSet = {}
Object.keys(flags).forEach((k) => {
const kebab = kebabCase(k)
const camel = camelCase(k)
const snake = snakeCase(k)
result[kebab] = flags[k]
result[camel] = flags[k]
result[snake] = flags[k]
result[k] = flags[k]
})
return result
})

Describe the solution you'd like
The withLDConsumer should be passing the mocked flags object as a prop, to the rendered component.

@carmenquan
Copy link

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

@sangeethsivanb
Copy link

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!

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

3 participants