mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-17 01:50:47 +02:00
Merge branch 'master' of https://github.com/deniswolf/NodeBB
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
generateUUID: function() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = Math.random() * 16 | 0,
|
||||
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
},
|
||||
@@ -225,4 +225,4 @@
|
||||
module: {
|
||||
exports: {}
|
||||
}
|
||||
} : module)
|
||||
} : module);
|
||||
9
tests/.jshintrc
Normal file
9
tests/.jshintrc
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"strict" : false, // true: Requires all functions run in ES5 Strict Mode
|
||||
|
||||
// Custom Globals
|
||||
"globals" : {
|
||||
"it": false,
|
||||
"describe": false
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,28 @@ describe("Utility Methods", function(){
|
||||
var username = "John\"'-. Doeäâèéë1234";
|
||||
assert(utils.isUserNameValid(username), 'invalid 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(){
|
||||
var email = 'sample@example.com';
|
||||
assert(utils.isEmailValid(email), 'invalid email');
|
||||
});
|
||||
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(){
|
||||
var uuid1 = utils.generateUUID(),
|
||||
uuid2 = utils.generateUUID();
|
||||
assert.notEqual(uuid1, uuid2, "matches");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user