v1.18.x
Barış Soner Uşaklı 7 years ago
parent 5e89c52041
commit 0a5d16d1cd

1
.gitignore vendored

@ -29,6 +29,7 @@ pidfile
/public/sounds /public/sounds
/public/uploads /public/uploads
/test/uploads
# compiled files # compiled files
/public/stylesheet.css /public/stylesheet.css

@ -17,7 +17,7 @@ nconf.file({ file: path.join(__dirname, '../../config.json') });
nconf.defaults({ nconf.defaults({
base_dir: path.join(__dirname, '../..'), base_dir: path.join(__dirname, '../..'),
themes_path: path.join(__dirname, '../../node_modules'), themes_path: path.join(__dirname, '../../node_modules'),
upload_path: 'public/uploads', upload_path: 'test/uploads',
views_dir: path.join(__dirname, '../../build/public/templates'), views_dir: path.join(__dirname, '../../build/public/templates'),
relative_path: '', relative_path: '',
}); });
@ -173,6 +173,21 @@ function setupMockDefaults(callback) {
id: 'nodebb-theme-persona', id: 'nodebb-theme-persona',
}, next); }, 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); ], callback);
} }
db.setupMockDefaults = setupMockDefaults; db.setupMockDefaults = setupMockDefaults;

@ -816,7 +816,7 @@ describe('User', function () {
}, function (err, uploadedPicture) { }, function (err, uploadedPicture) {
assert.ifError(err); assert.ifError(err);
assert.equal(uploadedPicture.url, '/assets/uploads/profile/' + uid + '-profileavatar.png'); 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(); done();
}); });
} }

Loading…
Cancel
Save