Skip to content

Commit

Permalink
add test for query string check in file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Dec 28, 2024
1 parent 7a71981 commit 97bb180
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/filetest/test/file_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ describe("/file", () => {
})

it('/upload with right file name', (done) => {
request.post('/file/upload').attach("jsstore", "static/fort_js_logo_200_137.png").end((err, res) => {
expect(err).to.be.null;
console.log("body", res.body);
expect(res).to.have.status(200);
expect(res).to.have.header('content-type', 'application/json');
expect(res.body.responseText).to.be.equal('file saved');
expect(res.body.fieldName).to.be.equal('jsstore');
expect(res.body.count).to.be.equal(1);
expect(res.body.fileName).to.be.equal('fort_js_logo_200_137.png');
expect(res.body.data).to.eql({
"fileInfo": {
"fieldName": "jsstore",
"fileName": "fort_js_logo_200_137.png"
},
"query": {
},
"singletonFileName": "upload.png",
"className": "FileName"
});
done();
});
})


it('/upload with right file name with query', (done) => {
request.post('/file/upload?test=1').attach("jsstore", "static/fort_js_logo_200_137.png").end((err, res) => {
expect(err).to.be.null;
console.log("body", res.body);
Expand Down

0 comments on commit 97bb180

Please sign in to comment.