我有以下代码可以测试上传文件,并且文件上传成功完成, 但是我想进行单元测试,所以我不将文件发送到仅想模拟它的s3 aws。 知道如何模拟文件吗?
it('should upload the file when a file is attached and there is an auth
header ', done => { //need to be mocked
request.post('/opportunity/xxx/documents/test/pages/1')
.set('Authorization', 'someauth lalalalala')
.set('Content-Type','multipart-formdata')
.attach('image','test/helpers/test.jpeg')
.then(response => {
expect(response.status).to.equal(200)
done()
},done)
})