how to test async function making use of moxios?
问题 Consider the following react code. sendFormData = async formData => { try { const image = await axios.post("/api/image-upload", formData); this.props.onFileNameChange(image.data); this.setState({ uploading: false }); } catch (error) { console.log("This errors is coming from ImageUpload.js"); console.log(error); } }; Here is the test it("should set uploading back to false on file successful upload", () => { const data = "dummydata"; moxios.stubRequest("/api/image-upload", { status: 200,