launchdarkly / jest-launchdarkly-mock

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

add support for mocking launchdarkly-js-client-sdk #13

Open blimmer opened 3 years ago

blimmer commented 3 years ago

right now, this package only works if you're using the react SDK: https://github.com/launchdarkly-labs/jest-launchdarkly-mock/blob/4a9f50510c6057f43a54cb1677f99f1b0fe402bf/src/index.ts#L1

I'm using vue and it would be great to be able to use this helper

ghost commented 3 years ago

This would be good to see, or have a note on the README stating that this is only for the react SDK

cameron-hicks commented 2 years ago

Any updates? Still facing this issue.

yusinto commented 2 years ago

Thank you for submitting this issue. We are considering supporting both the js sdk and the node sdk with this package but we don't have a timeline right now. I'll keep this issue open and will post an update when there's one.

darktasevski commented 2 years ago

I've written something that can be used to mock LD when using js-sdk. I'm using this approach in my tests, and it seems to work fine.

@yusinto please take a look when you can; maybe you can reuse what I did to speed up the release of the official js-sdk mock for LD. :)

https://gist.github.com/darktasevski/9e441edf17d2f91898d10d2c58d8d5f9

Edit: updated the gist URL, ty for catching the issue @megustalafantabienfria

a-vizuet commented 2 years ago

I've written something that can be used to mock LD when using js-sdk. I'm using this approach in my tests, and it seems to work fine.

@yusinto please take a look when you can; maybe you can reuse what I did to speed up the release of the official js-sdk mock for LD. :)

https://gist.github.com/d-tasevski/9e441edf17d2f91898d10d2c58d8d5f9

I get a 404 when I try to open your gist :( can you share it again? pls

EDIT: Thanks! It worked for what I was trying to test :)