Has anyone successfully mocked any aspect of the prismic-javascript library.
I am wanting to mock the response from the query function on the Api object received from getApi. This is so I can test our response should the query timeout now that we can pass a timeout argument.
I can mock the getApi or Predicates functionality but not query function.
Yeah, no worries. The nuance that we are struggling with is the typings in typescript and the fact we have to mock an instance of ResolvedApi. This is so we can mock .query and test our behaviour. All good, we are working on it.
@david.halewood, did you ever make progress on this? I hit exactly the same issue yesterday: I want to write some tests of my components which query Prismic and find myself needing to mock ResolvedApi in a way which keeps Typescript happy.