From 0a5d16d1cd8cc0adc65aad33c5bbbd391ad2e364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 26 Jan 2018 15:50:26 -0500 Subject: [PATCH] closes #6284 --- .gitignore | 1 + test/mocks/databasemock.js | 17 ++++++++++++++++- test/user.js | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 76eb6aa59c..2ae33250b3 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ pidfile /public/sounds /public/uploads +/test/uploads # compiled files /public/stylesheet.css diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js index 5314894543..0bef41c466 100644 --- a/test/mocks/databasemock.js +++ b/test/mocks/databasemock.js @@ -17,7 +17,7 @@ nconf.file({ file: path.join(__dirname, '../../config.json') }); nconf.defaults({ base_dir: path.join(__dirname, '../..'), themes_path: path.join(__dirname, '../../node_modules'), - upload_path: 'public/uploads', + upload_path: 'test/uploads', views_dir: path.join(__dirname, '../../build/public/templates'), relative_path: '', }); @@ -173,6 +173,21 @@ function setupMockDefaults(callback) { id: 'nodebb-theme-persona', }, next); }, + function (next) { + var rimraf = require('rimraf'); + rimraf('test/uploads', next); + }, + function (next) { + var mkdirp = require('mkdirp'); + async.eachSeries([ + 'test/uploads', + 'test/uploads/category', + 'test/uploads/files', + 'test/uploads/system', + 'test/uploads/sounds', + 'test/uploads/profile', + ], mkdirp, next); + }, ], callback); } db.setupMockDefaults = setupMockDefaults; diff --git a/test/user.js b/test/user.js index 8de7491761..897bb71a78 100644 --- a/test/user.js +++ b/test/user.js @@ -816,7 +816,7 @@ describe('User', function () { }, function (err, uploadedPicture) { assert.ifError(err); assert.equal(uploadedPicture.url, '/assets/uploads/profile/' + uid + '-profileavatar.png'); - assert.equal(uploadedPicture.path, path.join(nconf.get('base_dir'), 'public', 'uploads', 'profile', uid + '-profileavatar.png')); + assert.equal(uploadedPicture.path, path.join(nconf.get('upload_path'), 'profile', uid + '-profileavatar.png')); done(); }); }