This causes issues where if the flag is not a "valid" kebab-case string or camelCase string, it is not included in the flags set. For example, the flag Client-MyCoolFlag gets converted to client-my-cool-flag and clientMyCoolFlag, neither of which are the original flag.
Recommendation
Also store the original string in the flags set to allow flags that don't conform exactly to camel or kebab casing to be mocked properly.
Problem
When passing a string to
mockFlags
, it converts the string usinglodash.kebabcase
andlodash.camelcase
, but does not also store the original string: https://github.com/launchdarkly-labs/jest-launchdarkly-mock/blob/4a9f50510c6057f43a54cb1677f99f1b0fe402bf/src/index.ts#L44-L53This causes issues where if the flag is not a "valid" kebab-case string or camelCase string, it is not included in the flags set. For example, the flag
Client-MyCoolFlag
gets converted toclient-my-cool-flag
andclientMyCoolFlag
, neither of which are the original flag.Recommendation
Also store the original string in the flags set to allow flags that don't conform exactly to camel or kebab casing to be mocked properly.