I am wondering if anyone else has come up with a solution to this. I am building a custom frontend app with React and TS, and am having quite a bit of frustration trying to isolate out the Contentful SDK so I can run unit tests.
As far as I can tell from the docs the SDK needs to be passed in at the root component where the init function is called. Then the SDK, or at least part of it, is passed through as props to the child components.
This means when I am rendering a component for a unit test I need an SDK object to pass in as props. Looking at the SDK it’s going to be a nightmare to build out a manual mock. I am wondering is it possible to import the SDK at the component level, which would make it possible to mock with jest require actual. Or is there a test utility somewhere that builds out a mock SDK for testing?