Created
September 14, 2021 15:26
-
-
Save sabesansathananthan/e8765b41c0375434a494545886aad6f8 to your computer and use it in GitHub Desktop.
mock network request in Jest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios, { AxiosRequestConfig } from "axios"; | |
const instance = axios.create({ | |
timeout: 3000, | |
}); | |
export const request = (options: AxiosRequestConfig): Promise<any> => { | |
// do something wrap | |
return instance.request(options).then(res => res.data); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment