fix: use req.ip instead, since guests can upload as well

This commit is contained in:
psychobunny
2021-04-18 19:19:52 -04:00
committed by Andrew Rodrigues
parent a9978fcfd2
commit ea22cd302a
2 changed files with 13 additions and 8 deletions

View File

@@ -151,6 +151,16 @@ describe('Upload Controllers', () => {
});
});
it('should fail to upload image to post if image is broken', (done) => {
helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/brokenimage.png'), {}, jar, csrf_token, (err, res, body) => {
assert.ifError(err);
assert.strictEqual(res.statusCode, 500);
assert(body && body.status && body.status.message);
assert(body.status.message.startsWith('Input file has corrupt header: pngload: end of stream'));
done();
});
});
it('should fail to upload image to post if image dimensions are too big', (done) => {
helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/toobig.jpg'), {}, jar, csrf_token, (err, res, body) => {
assert.ifError(err);