// app/domain/index.js
export * from './negotiation';
export * from './negotiations';
// app/app.js
import { Negotiation, Negotiations } from './domain';
如何模拟这种类型的Axios请求?我正在使用Jest在本机反应项目中进行测试(没有EXPO)
答案 0 :(得分:2)
import axios from 'axios';
jest.mock('axios');
describe('fetchData', () => {
it('fetches successfully data from an API', async () => {
const data = {
data: {
},
};
axios.get.mockImplementationOnce(() => Promise.resolve(data));
});