Skip to content

Commit

Permalink
feat: one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Aug 12, 2020
1 parent ecda4ad commit a333cb6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/user.js
Expand Up @@ -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);
Expand Down

0 comments on commit a333cb6

Please sign in to comment.