我无法编写异步api的测试用例
我尝试使用mockAxios
export const exportAllCustomers = ({ token, start_date, end_date }) => {
var url = getExportUrl({start_date, end_date})
console.log("start_date ", start_date)
console.log("in export data ", url)
return (dispatch) => new Promise(async (resolve, reject) => {
dispatch(showLoading())
axios.get(API_ENDPOINT +url,{
headers: {
Authorization: 'Token ' + token,
}
})
.then((response) => {
dispatch(hideLoading())
return resolve (response.data);
})
.catch((error) => {
dispatch(hideLoading())
return reject ("error: ");
});
期望值是客户列表,但没有得到。