mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 18:16:36 +02:00
fix tests
This commit is contained in:
17
test/user.js
17
test/user.js
@@ -399,19 +399,22 @@ describe('User', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should change a user\'s password', function (done) {
|
it('should change a user\'s password', function (done) {
|
||||||
this.timeout(20000);
|
var socketUser = require('../src/socket.io/user');
|
||||||
io.emit('user.changePassword', { uid: uid, newPassword: '654321', currentPassword: '123456' }, function (err) {
|
User.create({ username: 'changepassword', password: '123456' }, function (err, uid) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
User.isPasswordCorrect(uid, '654321', function (err, correct) {
|
socketUser.changePassword({ uid: uid }, { uid: uid, newPassword: '654321', currentPassword: '123456' }, function (err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert(correct);
|
User.isPasswordCorrect(uid, '654321', function (err, correct) {
|
||||||
done();
|
assert.ifError(err);
|
||||||
|
assert(correct);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change username', function (done) {
|
it('should change username', function (done) {
|
||||||
io.emit('user.changeUsernameEmail', { uid: uid, username: 'updatedAgain', password: '654321' }, function (err) {
|
io.emit('user.changeUsernameEmail', { uid: uid, username: 'updatedAgain', password: '123456' }, function (err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
db.getObjectField('user:' + uid, 'username', function (err, username) {
|
db.getObjectField('user:' + uid, 'username', function (err, username) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
@@ -422,7 +425,7 @@ describe('User', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should change email', function (done) {
|
it('should change email', function (done) {
|
||||||
io.emit('user.changeUsernameEmail', { uid: uid, email: 'updatedAgain@me.com', password: '654321' }, function (err) {
|
io.emit('user.changeUsernameEmail', { uid: uid, email: 'updatedAgain@me.com', password: '123456' }, function (err) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
db.getObjectField('user:' + uid, 'email', function (err, email) {
|
db.getObjectField('user:' + uid, 'email', function (err, email) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user