Skip to content

Node.js based forum software built for the modern web

closes #6284

Barış Soner Uşaklı0a5d16d1cd8c
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();
});
}