Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
Going based off the documentation I sent you in my last reply, there is an example that uses nock to emulate api responses. I haven't used nock myself, but the example seems pretty simple to use. You just need to take the example and change the response object to be the shape of what your getStuffFromDatabase function returns. That way your useCategory function runs as close to normally as possible, while providing a mock response value instead of hitting the database.
Related posts
- Contract Testing?
- I made wirepig, a simple way to mock HTTP and TCP dependencies in tests.
- Is there a better way to mock an axios call?
- How to test an endpoint that depends on external API?
- Is there a publicly-available mock Instagram Graph API server? If not, how can I get one set up quickly & easily?