diff options
Diffstat (limited to 'deps/npm/node_modules/npm-user-validate/test/username.test.js')
-rw-r--r-- | deps/npm/node_modules/npm-user-validate/test/username.test.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/deps/npm/node_modules/npm-user-validate/test/username.test.js b/deps/npm/node_modules/npm-user-validate/test/username.test.js index d30ec8afe71..83528eec82a 100644 --- a/deps/npm/node_modules/npm-user-validate/test/username.test.js +++ b/deps/npm/node_modules/npm-user-validate/test/username.test.js @@ -2,25 +2,41 @@ var test = require('tap').test var v = require('../npm-user-validate.js').username test('username must be lowercase', function (t) { - err = v('ERRR') + var err = v('ERRR') t.type(err, 'object') + t.match(err.message, /lowercase/) t.end() }) test('username may not contain non-url-safe chars', function (t) { - err = v('f ') + var err = v('f ') t.type(err, 'object') + t.match(err.message, /url-safe/) t.end() }) test('username may not start with "."', function (t) { - err = v('.username') + var err = v('.username') t.type(err, 'object') + t.match(err.message, /start with.*\./) t.end() }) +test('username may not be longer than 576 characters', function (t) { + var err = v('bacon-ipsum-dolor-amet-tongue-short-loin-landjaeger-tenderloin-ball-tip-pork-loin-porchetta-pig-pork-chop-beef-ribs-pork-belly--shankle-t-bone-turducken-tongue-landjaeger-pork-loin-beef-chicken-short-loin-venison-capicola--brisket-leberkas-pork-beef-ribs-kevin-short-ribs-tail-bresaola-ham--rump-fatback-short-ribs-frankfurter-boudin--turkey-cupim-tri-tip-pork-chop-landjaeger-frankfurter-ham-hock---kielbasa-sausage-sirloin-short-loin-bacon-tenderloin-biltong-spare-ribs-cow-beef-ribs-tongue-cupim-filet-mignon-drumstick--pork-chop-tenderloin-brisket-pork-belly-leberkas-and-a-pickle') + t.type(err, 'object') + t.match(err.message, /less than or equal to 576/) + t.end() +}); + +test('username may be as long as 576 characters', function (t) { + var err = v('bacon-ipsum-dolor-amet-tongue-short-loin-landjaeger-tenderloin-ball-tip-pork-loin-porchetta-pig-pork-chop-beef-ribs-pork-belly--shankle-t-bone-turducken-tongue-landjaeger-pork-loin-beef-chicken-short-loin-venison-capicola--brisket-leberkas-pork-beef-ribs-kevin-short-ribs-tail-bresaola-ham--rump-fatback-short-ribs-frankfurter-boudin--turkey-cupim-tri-tip-pork-chop-landjaeger-frankfurter-ham-hock---kielbasa-sausage-sirloin-short-loin-bacon-tenderloin-biltong-spare-ribs-cow-beef-ribs-tongue-cupim-filet-mignon-drumstick--pork-chop-tenderloin-brisket-pork-belly-leberkas-beef') + t.type(err, 'null') + t.end() +}); + test('username is ok', function (t) { - err = v('ente') + var err = v('ente') t.type(err, 'null') t.end() }) |