From 59b988a2055875b17c323a01cc53ba40e366a589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 20 Sep 2018 22:09:20 -0400 Subject: [PATCH] change test so it checks url --- src/controllers/uploads.js | 6 +----- test/uploads.js | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js index 20431d5e3c..4421438cda 100644 --- a/src/controllers/uploads.js +++ b/src/controllers/uploads.js @@ -125,11 +125,7 @@ function resizeImage(fileObj, callback) { }, function (next) { // Return the resized version to the composer/postData - var dirname = path.dirname(fileObj.url); - var extname = path.extname(fileObj.url); - var basename = path.basename(fileObj.url, extname); - - fileObj.url = dirname + '/' + basename + '-resized' + extname; + fileObj.url = file.appendToFileName(fileObj.url, '-resized'); next(null, fileObj); }, diff --git a/test/uploads.js b/test/uploads.js index c44baa6272..17c388c7a8 100644 --- a/test/uploads.js +++ b/test/uploads.js @@ -115,6 +115,7 @@ describe('Upload Controllers', function () { assert.equal(res.statusCode, 200); assert(Array.isArray(body)); assert(body[0].url); + assert(body[0].url.match(/\/assets\/uploads\/files\/\d+-test-resized\.png/)); meta.config.maximumImageWidth = oldValue; done(); });