Im using react-nativ with expo, jest-fetch-mock and graphql. When calling the api Im getting error
× return user feed query (69ms)
● testing api › return user feed query
Unexpected end of JSON input
at new ApolloError (node_modules/@apollo/client/errors/index.js:29:28)
at node_modules/@apollo/client/core/QueryManager.js:611:19
at both (node_modules/@apollo/client/utilities/observables/asyncMap.js:16:53)
at node_modules/@apollo/client/utilities/observables/asyncMap.js:9:72
at tryCallTwo (node_modules/react-native/node_modules/promise/lib/core.js:45:5)
at doResolve (node_modules/react-native/node_modules/promise/lib/core.js:200:13)
api.test.js import fetch from 'jest-fetch-mock';
import { getUserFeed } from '../feed'
describe('testing api', () => {
beforeEach(() => {
fetch.resetMocks()
})
it('return user feed query', async () => {
//assert on the response
await getUserFeed(20).then(async (res) => {
console.log('watcher ' + res)
});
//assert on the times called and arguments given to fetch
console.log('watch ' + fetch.mock.calls.length)
expect(fetch.mock.calls.length).toEqual(20)
})
})