launchdarkly / jest-launchdarkly-mock

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

Prevent resetMocks: true from clearing mock implementations #58

Open michaeldfallen opened 1 year ago

michaeldfallen commented 1 year ago

Requirements

Describe the solution you've provided

If a team uses resetMocks: true in their jest config then the mocked functions of launchdarkly-react-client-sdk will return undefined during test execution.

To allow teams using resetMocks to use this package I have pulled the mock implementations into a setupMocks function that can be called in beforeEach.

I haven't updated the documentation to explain this usecase, I'd value feedback on where / how to do that.

yusinto commented 1 year ago

Thank you for submitting this PR. We will review and provide an update soon.