2
由于错误而无法使用Jest测试发布方法无法读取未定义的嘲笑
我有一个api服务,在这里我有不同的方法来调用API。我已经成功测试了所有GET请求,但是在测试POST请求时遇到了麻烦。 这是方法: export default class ApiService { static makeApiCall = <T>( url: string, oneCb: <T>(d: Data) => T, secondCb: (d: T) => void, errorCb?: (a: ErrorModel) => void, method = 'get', data = {}, ): Promise<void> => { const config: AxiosRequestConfig = {}; if (method === 'post') { config.headers = …