'what do you need to import into react to use spy on with jest?

I'm currently getting an error when trying to use spyOn().

TypeError: Cannot read properties of undefined (reading 'spyOn')

      20 |   it("should return success response", async () => {
      21 |     //  mock external axios dependency for error response
    > 22 |     jest.spyOn(axios, "get").mockRejectedValue({

do i need to import into react to use? And what specifically do I need to import?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source