I'm getting an error mocking my api call
TypeError: Cannot read property 'mockResolvedValue" of undefined
and cannot figure out why. I'm utilizing jest to test my api fetch call function.
This is my function I'm exporting:
//file amData.jsx
const axios = require('axios');
async function fetchAssetManagerSummary() {
const response = await axios.get("https://www.exampleUrl.com");
return response.data;
}
module.exports = fetchAssetManagerSummary;
This is my test file
const fetchAssetManagerSummary = require('./amData');
const axios = require('axios');
jest.mock("axios");
it("returns the object from fetch", async () => {
axios.get.mockResolvedValue({
data: [
{
userId: 1,
id: 1,
title: 'test'
}
]
})
const data = await fetchAssetManagerSummary();
console.log("data", data)
});
The error I'm getting: