Skip to content

Node.js based forum software built for the modern web

test: update tests

Barış Soner Uşaklıd8fd2aab06c9
diff --git a/test/controllers.js b/test/controllers.js
index 4108f8a3d7..7f0751871d 100644
--- a/test/controllers.js
+++ b/test/controllers.js
@@ -1298,11 +1298,14 @@ describe('Controllers', () => {
});
it('should parse about me', async () => {
- await user.setUserFields(fooUid, { picture: '/assets/uploads/path/to/picture', aboutme: 'hi i am a bot [[topic:moved-from]] <script>alert("xss")</script>' });
+ await user.setUserFields(fooUid, {
+ picture: '/assets/uploads/path/to/picture',
+ aboutme: 'hi i am a bot [[topic:moved-from]] <script>alert("xss")</script>',
+ });
const { response, body } = await request.get(`${nconf.get('url')}/api/user/foo`);
assert.equal(response.statusCode, 200);
assert.equal(body.aboutmeParsed, 'hi i am a bot &lsqb;&lsqb;topic:moved-from&rsqb;&rsqb; ');
- assert.equal(body.picture, '&#x2F;assets&#x2F;uploads&#x2F;path&#x2F;to&#x2F;picture');
+ assert.equal(body.picture, '/assets/uploads/path/to/picture');
});
it('should not return reputation if reputation is disabled', async () => {
diff --git a/test/user.js b/test/user.js
index 541bff08cf..49f4d73b88 100644
--- a/test/user.js
+++ b/test/user.js
@@ -1000,7 +1000,7 @@ describe('User', () => {
assert.strictEqual(body.status.code, 'ok');
const picture = await User.getUserField(uid, 'picture');
- assert.strictEqual(picture, validator.escape('https://example.org/picture.jpg'));
+ assert.strictEqual(picture, 'https://example.org/picture.jpg');
});
it('should fail to change user picture with invalid data', async () => {
@@ -1031,7 +1031,7 @@ describe('User', () => {
await db.sortedSetAdd(`uid:${uid}:profile:pictures`, Date.now(), '/assets/uploads/test');
await apiUser.changePicture({ uid: uid }, { type: 'uploaded', picture: '/assets/uploads/test', uid: uid });
const picture = await User.getUserField(uid, 'picture');
- assert.equal(picture, validator.escape(`${nconf.get('relative_path')}/assets/uploads/test`));
+ assert.equal(picture, `${nconf.get('relative_path')}/assets/uploads/test`);
});
it('should return error if profile image uploads disabled', (done) => {