chakram icon indicating copy to clipboard operation
chakram copied to clipboard

No files found

Open amiteshCoder opened this issue 6 years ago • 0 comments

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

amiteshCoder avatar Nov 09 '18 17:11 amiteshCoder