Skip to content

Node.js based forum software built for the modern web

test: add test for #13729

Barış Soner Uşaklı430a3e81130a
diff --git "a/test/files/\346\265\213\350\257\225.jpg" "b/test/files/\346\265\213\350\257\225.jpg"
new file mode 100644
index 0000000000..905e886eef
Binary files /dev/null and "b/test/files/\346\265\213\350\257\225.jpg" differ
diff --git a/test/uploads.js b/test/uploads.js
index 1e5b3d19e3..8a57c0d06e 100644
--- a/test/uploads.js
+++ b/test/uploads.js
@@ -194,6 +194,12 @@ describe('Upload Controllers', () => {
assert(body.response.images[0].url);
});
+ it('should upload a file with utf8 characters in the name to a post', async () => {
+ const { body } = await helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/测试.jpg'), {}, jar, csrf_token);
+
+ assert(body.response.images[0].url.endsWith('测试.jpg'));
+ });
+
it('should fail to upload image to post if image dimensions are too big', async () => {
const { response, body } = await helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/toobig.png'), {}, jar, csrf_token);
assert.strictEqual(response.statusCode, 500);