I'm afraid I am not familiar with the Apollo library but it looks to me like the mock is not working; instead it is attempting a real http call to localhost:80.

I expect that the reason you don't see the error when you don't 'await' is because the http request itself is asynchronous so it does not get a chance to run before you do the assertion if there is no 'await' in the test.

Looking at the code I surmise that you are prepopulating a cache with data so it should not attempt network access? I suggest stepping through the 'mount' function or hook with a debugger and try to see if the mock data is ending up where you expect it to be. I have often got confused with java script values not ending up where I expect!

Sorry I couldn't be more help.

Related Query

More Query from same tag