Node.js based forum software built for the modern web
jslinting on holiday ftw
psychobunnyf3a113d318d9
diff --git a/tests/categories.js b/tests/categories.jsindex 7909f0a0f8..95c7a0f14b 100644--- a/tests/categories.js+++ b/tests/categories.js@@ -1,3 +1,5 @@+'use strict';+/*global require, process, after*/var winston = require('winston');diff --git a/tests/database.js b/tests/database.jsindex 9118823d00..3f8c119002 100644--- a/tests/database.js+++ b/tests/database.js@@ -1,6 +1,8 @@+'use strict';+/*global require*/+var assert = require('assert'),- db = require('./mocks/databasemock'),- async = require('async');+ db = require('./mocks/databasemock');describe('Test database', function() {diff --git a/tests/groups.js b/tests/groups.jsindex 02d9cd2ffa..6f36cbfa2c 100644--- a/tests/groups.js+++ b/tests/groups.js@@ -1,3 +1,6 @@+'use strict';+/*global require, before, after*/+var assert = require('assert'),async = require('async'),@@ -14,7 +17,7 @@ describe('Groups', function() {},function(next) {// Create a new user- User.create({+ User.create({username: 'testuser',email: '[email protected]'}, done);diff --git a/tests/messaging.js b/tests/messaging.jsindex 29d3e79418..a709640430 100644--- a/tests/messaging.js+++ b/tests/messaging.js@@ -1,3 +1,6 @@+'use strict';+/*global require, before, after*/+var assert = require('assert'),db = require('./mocks/databasemock'),async = require('async'),@@ -6,7 +9,7 @@ var assert = require('assert'),Messaging = require('../src/messaging'),testUids;-describe("Messaging Library", function() {+describe('Messaging Library', function() {before(function(done) {// Create 3 users: 1 admin, 2 regularasync.parallel([@@ -22,7 +25,7 @@ describe("Messaging Library", function() {});});- describe(".canMessage()", function() {+ describe('.canMessage()', function() {it('should not error out', function(done) {Messaging.canMessage(testUids[1], testUids[2], function(err, allowed) {assert.ifError(err);@@ -30,14 +33,14 @@ describe("Messaging Library", function() {});});- it("should allow messages to be sent to an unrestricted user", function(done) {+ it('should allow messages to be sent to an unrestricted user', function(done) {Messaging.canMessage(testUids[1], testUids[2], function(err, allowed) {assert.strictEqual(allowed, true, 'should be true, received ' + allowed);done();});});- it("should NOT allow messages to be sent to a restricted user", function(done) {+ it('should NOT allow messages to be sent to a restricted user', function(done) {User.setSetting(testUids[1], 'restrictChat', '1', function() {Messaging.canMessage(testUids[2], testUids[1], function(err, allowed) {assert.strictEqual(allowed, false, 'should be false, received ' + allowed);@@ -46,14 +49,14 @@ describe("Messaging Library", function() {});});- it("should always allow admins through", function(done) {+ it('should always allow admins through', function(done) {Messaging.canMessage(testUids[0], testUids[1], function(err, allowed) {assert.strictEqual(allowed, true, 'should be true, received ' + allowed);done();});});- it("should allow messages to be sent to a restricted user if restricted user follows sender", function(done) {+ it('should allow messages to be sent to a restricted user if restricted user follows sender', function(done) {User.follow(testUids[1], testUids[2], function() {Messaging.canMessage(testUids[2], testUids[1], function(err, allowed) {assert.strictEqual(allowed, true, 'should be true, received ' + allowed);diff --git a/tests/topics.js b/tests/topics.jsindex 6ee2d3ca79..bdc15643ba 100644--- a/tests/topics.js+++ b/tests/topics.js@@ -1,4 +1,5 @@'use strict';+/*global require, before, beforeEach, after*/var assert = require('assert'),db = require('./mocks/databasemock'),diff --git a/tests/user.js b/tests/user.jsindex 9e53b4c4c5..3ef541623b 100644--- a/tests/user.js+++ b/tests/user.js@@ -1,3 +1,6 @@+'use strict';+/*global require, process, before, beforeEach, after*/+var winston = require('winston');process.on('uncaughtException', function (err) {diff --git a/tests/utils.js b/tests/utils.jsindex ec88aa24c1..befb2f78d2 100644--- a/tests/utils.js+++ b/tests/utils.js@@ -1,35 +1,38 @@+'use strict';+/*global require*/+var assert = require('assert'),utils = require('./../public/src/utils.js');-describe("Utility Methods", function(){- describe("username validation", function(){- it("accepts latin-1 characters", function(){+describe('Utility Methods', function(){+ describe('username validation', function(){+ it('accepts latin-1 characters', function(){var username = "John\"'-. Doeäâèéë1234";assert(utils.isUserNameValid(username), 'invalid username');});- it("rejects empty string", function(){- var username = "";+ it('rejects empty string', function(){+ var username = '';assert.ifError(utils.isUserNameValid(username), 'accepted as valid username');});});- describe("email validation", function(){- it("accepts sample address", function(){+ describe('email validation', function(){+ it('accepts sample address', function(){var email = '[email protected]';assert(utils.isEmailValid(email), 'invalid email');});- it("rejects empty address", function(){+ it('rejects empty address', function(){var email = '';assert.ifError(utils.isEmailValid(email), 'accepted as valid email');});});- describe("UUID generation", function(){- it("return unique random value every time", function(){+ describe('UUID generation', function(){+ it('return unique random value every time', function(){var uuid1 = utils.generateUUID(),uuid2 = utils.generateUUID();- assert.notEqual(uuid1, uuid2, "matches");+ assert.notEqual(uuid1, uuid2, 'matches');});});});