Skip to content

Node.js based forum software built for the modern web

add new test for queue

Barış Soner Uşaklı19e6c612442f
diff --git a/test/user.js b/test/user.js
index 650c4215a7..7c49813c82 100644
--- a/test/user.js
+++ b/test/user.js
@@ -1483,6 +1483,34 @@ describe('User', function () {
});
});
+ it('should fail to add user to queue if username is taken', function (done) {
+ helpers.registerUser({
+ username: 'rejectme',
+ password: '123456',
+ 'password-confirm': '123456',
+ email: '<script>alert("ok")<script>[email protected]',
+ gdpr_consent: true,
+ }, function (err, jar, res, body) {
+ assert.ifError(err);
+ assert.equal(body, '[[error:username-taken]]');
+ done();
+ });
+ });
+
+ it('should fail to add user to queue if email is taken', function (done) {
+ helpers.registerUser({
+ username: 'rejectmenew',
+ password: '123456',
+ 'password-confirm': '123456',
+ email: '<script>alert("ok")<script>[email protected]',
+ gdpr_consent: true,
+ }, function (err, jar, res, body) {
+ assert.ifError(err);
+ assert.equal(body, '[[error:email-taken]]');
+ done();
+ });
+ });
+
it('should reject user registration', function (done) {
socketAdmin.user.rejectRegistration({ uid: adminUid }, { username: 'rejectme' }, function (err) {
assert.ifError(err);