我想测试我的反应dropzone onDrop方法,这是我到目前为止所尝试的。
describe("RoadOrders", () => {
let props;
let mountedRoadOrders;
const roadOrders = () => {
if (!mountedRoadOrders) {
mountedRoadOrders = mount(
<MuiThemeProvider muiTheme={getMuiTheme()}>
<Provider store={store}>
<RoadOrders {...props} />
</Provider>
</MuiThemeProvider>
);
}
return mountedRoadOrders;
}
beforeEach(() => {
props = {};
mountedRoadOrders = undefined;
});
describe("when dropped file", () => {
beforeEach(() => {
props.uploadFiles = undefined;
});
it("should upload that file to firebase", () => {
const uploadFiles = roadOrders().find("Dropzone");
uploadFiles.simulate('drop', {
target: {
files: [
'a.jpg',
'b.jpg',
'c.jpg'
]
}
})
expect(roadOrders()).toBe(1);
});
});
});
似乎onDrop功能确实已触发,但文件未成功上传到云端。如何测试文件上传功能并检查服务器的回调以查看它们是否已传递到服务器?