Skip to content

Node.js based forum software built for the modern web

fix test on nodev4 remove console.logs

Barış Soner Uşaklı873801e9f316
diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.json
index 89222f622f..8d106b6a79 100644
--- a/public/language/en-GB/error.json
+++ b/public/language/en-GB/error.json
@@ -1,5 +1,6 @@
{
"invalid-data": "Invalid Data",
+ "invalid-json": "Invalid JSON",
"not-logged-in": "You don't seem to be logged in.",
"account-locked": "Your account has been locked temporarily",
diff --git a/src/controllers/admin/uploads.js b/src/controllers/admin/uploads.js
index 4e9cac610e..b23f67ea0a 100644
--- a/src/controllers/admin/uploads.js
+++ b/src/controllers/admin/uploads.js
@@ -24,7 +24,7 @@ uploadsController.uploadCategoryPicture = function (req, res, next) {
params = JSON.parse(req.body.params);
} catch (e) {
deleteTempFile(uploadedFile.path);
- return next(e);
+ return next(new Error('[[error:invalid-json]]'));
}
if (validateUpload(req, res, next, uploadedFile, allowedImageTypes)) {
diff --git a/test/uploads.js b/test/uploads.js
index 6e20fcffcb..57b7a67ed0 100644
--- a/test/uploads.js
+++ b/test/uploads.js
@@ -176,7 +176,6 @@ describe('Upload Controllers', function () {
it('should fail to upload invalid file type', function (done) {
helpers.uploadFile(nconf.get('url') + '/api/admin/category/uploadpicture', path.join(__dirname, '../test/files/503.html'), { params: JSON.stringify({ cid: cid }) }, jar, csrf_token, function (err, res, body) {
assert.ifError(err);
- console.log(body);
assert.equal(body.error, '[[error:invalid-image-type, image/png, image/jpeg, image/pjpeg, image/jpg, image/gif, image/svg+xml]]');
done();
});
@@ -185,7 +184,7 @@ describe('Upload Controllers', function () {
it('should fail to upload category image with invalid json params', function (done) {
helpers.uploadFile(nconf.get('url') + '/api/admin/category/uploadpicture', path.join(__dirname, '../test/files/test.png'), { params: 'invalid json' }, jar, csrf_token, function (err, res, body) {
assert.ifError(err);
- assert.equal(body.error, 'Unexpected token i in JSON at position 0');
+ assert.equal(body.error, '[[error:invalid-json]]');
done();
});
});
@@ -215,7 +214,6 @@ describe('Upload Controllers', function () {
assert.ifError(err);
assert.equal(res.statusCode, 200);
assert(body);
- console.log(body);
done();
});
});