test: add test for #13729

This commit is contained in:
Barış Soner Uşaklı
2025-10-24 11:12:20 -04:00
parent 9410f466d8
commit 430a3e8113
2 changed files with 6 additions and 0 deletions

BIN
test/files/测试.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

View File

@@ -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);