 
   it 'should send HTTP 400 when username length is not valid', (done) ->
 
-    values = [1, 3, 26]
+    { minLength, maxLength } = JUser.getValidUsernameLengthRange()
+    values = [minLength - 1, maxLength + 1]
     queue  = []
 
     values.forEach (length) ->

{ withConvertedUser }               = require '../../../../../workers/social/testhelper'
{ withConvertedUserAndApiToken }    = require '../../../../../workers/social/testhelper/models/apitokenhelper'
{ generateCreateUserRequestParams } = require '../../../../testhelper/handler/createuserhelper'

apiErrors = require './errors'
JUser     = require '../../../../models/user'


  it 'should send HTTP 400 when suggested username length is not valid', (done) ->

    values = [SUGGESTED_USERNAME_MIN_LENGTH - 1, SUGGESTED_USERNAME_MAX_LENGTH + 1]
    queue  = []

    values.forEach (length) ->
