I am making a get request to an API using requestjs and then in the requestCallBack mapping the body to a custom json object. I am trying to test this code using Jest but no matter how I mock it, it doesn't seem to work
I have tried request.get.mockImplementation()
and that seems to only mock the get and doesn't let me test the code in the callback
await request.get('endpoint', requestOptions, (err, res, body) => { transformBodyContent(body) })
jest.mock('request')
jest.mock('request-promise-native')
import request from 'request-promise-native'
test('test requestCallback code', async () => {
// not sure how to test that bodyTransformer is called and is working
}