mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	Rename tests folder to test to follow standards
This commit is contained in:
		
							
								
								
									
										38
									
								
								test/utils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								test/utils.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +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(){ | ||||
| 			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