Вот ошибка:
TypeError: _axios.default.get.mockResolvedValue is not a function
20 | ]
21 | }
> 22 | Axios.get.mockResolvedValue(response);
| ^
23 |
24 | const component = renderer.create(
25 | <BookList />
Вот мой код:
import React from "react";
import Axios from "axios";
import {shallow, mount, render} from "enzyme";
import BookList from "../BookList";
import renderer from "react-test-renderer";
jest.mock('Axios');
test("<BookList /> snapshot test", () => {
const response = {
data: [
{
title: "foo"
},
{
title: "bar"
}
]
}
Axios.get.mockResolvedValue(response);
const component = renderer.create(
<BookList />
)
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
})