Open amiteshCoder opened 5 years ago
I am trying to upload a file using the chakram. But while doing so I am getting No files found error.
Here is the configuration of my test:
const fs = require('fs'); const chakram = require('chakram'), expect = chakram.expect; path = require("path"); describe("Upload Image", () => { it("Checks endpoint for status 200", () => { // Arrange const imagesService = new ImagesService(chakram); let file = path.resolve('./Users/amiteshshukla/Desktop/screenshots/', 'Screen_Shot_2018-07-04 at 12.00.54.png'); let formData = { "formData": { "file": fs.createReadStream(file), }, "Content-Type": "image/png", "Content-Disposition": "form-data" }; // Act const response = imagesService.hitsUploadImage(formData); response.then((res) => { console.log(res); }); // Assert return expect(response).to.have.status(200); }); });
Output: body: { errors: [ 'No files found' ], response: 'failed' },
Can anyone help me in solving this . Thanks in advance
I am trying to upload a file using the chakram. But while doing so I am getting No files found error.
Here is the configuration of my test:
Output: body: { errors: [ 'No files found' ], response: 'failed' },
Can anyone help me in solving this . Thanks in advance