Skip to content

Node.js based forum software built for the modern web

feat: one more test

Barış Soner Uşaklıa333cb6ca427
diff --git a/test/user.js b/test/user.js
index 7c49d1e31c..8f8f30c177 100644
--- a/test/user.js
+++ b/test/user.js
@@ -850,6 +850,16 @@ describe('User', function () {
assert.equal(err.message, '[[user:change_password_error_privileges]]');
});
+ it('should let admin change another users password', async function () {
+ const adminUid = await User.create({ username: 'adminpwdchange2', password: 'admin1234' });
+ await groups.join('administrators', adminUid);
+ const uid = await User.create({ username: 'forgotmypassword', password: '123456' });
+
+ await socketUser.changePassword({ uid: adminUid }, { uid: uid, newPassword: '654321' });
+ const correct = await User.isPasswordCorrect(uid, '654321', '127.0.0.1');
+ assert(correct);
+ });
+
it('should change username', function (done) {
socketUser.changeUsernameEmail({ uid: uid }, { uid: uid, username: 'updatedAgain', password: '123456' }, function (err) {
assert.ifError(err);