Skip to content

Node.js based forum software built for the modern web

test: use path.resolve to build upload_path in tests

Barış Soner Uşaklıe0865b14d774
diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js
index cb4ab65ba9..db80850056 100644
--- a/test/mocks/databasemock.js
+++ b/test/mocks/databasemock.js
@@ -49,7 +49,7 @@ const urlObject = new URL(nconf.get('url'));
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('relative_path', relativePath);
nconf.set('asset_base_url', `${relativePath}/assets`);
-nconf.set('upload_path', path.join(nconf.get('base_dir'), nconf.get('upload_path')));
+nconf.set('upload_path', path.resolve(nconf.get('base_dir'), nconf.get('upload_path')));
nconf.set('upload_url', '/assets/uploads');
nconf.set('url_parsed', {
href: urlObject.href,
diff --git a/test/uploads.js b/test/uploads.js
index 10caa8cdb2..2184d796a2 100644
--- a/test/uploads.js
+++ b/test/uploads.js
@@ -72,10 +72,10 @@ describe('Upload Controllers', () => {
// eslint-disable-next-line no-await-in-loop
const { response, body } = await helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/503.html'), {}, jar, csrf_token);
if (i + 1 >= times) {
- assert.strictEqual(response.statusCode, 500);
+ assert.strictEqual(response.statusCode, 500, JSON.stringify(body));
assert.strictEqual(body.error, '[[error:upload-ratelimit-reached]]');
} else {
- assert.strictEqual(response.statusCode, 200);
+ assert.strictEqual(response.statusCode, 200, JSON.stringify(body));
assert(body && body.status && body.response && body.response.images);
assert(Array.isArray(body.response.images));
assert(body.response.images[0].url);