diff options
author | Robert Kowalski <rok@kowalski.gd> | 2013-04-20 03:49:22 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-05-04 00:31:24 +0400 |
commit | 1cdd48197a516f2a7a4fce2b1c59c5420971e81d (patch) | |
tree | 4909f004ef21c34a97386a9a8488098ad5c2adbb /node_modules/npm-user-validate/test | |
parent | c199d38d9f68177ff2425e1078d47daa14993a8a (diff) |
add npm-user-validate@0.0.1
Diffstat (limited to 'node_modules/npm-user-validate/test')
-rw-r--r-- | node_modules/npm-user-validate/test/email.test.js | 26 | ||||
-rw-r--r-- | node_modules/npm-user-validate/test/pw.test.js | 32 | ||||
-rw-r--r-- | node_modules/npm-user-validate/test/username.test.js | 26 |
3 files changed, 84 insertions, 0 deletions
diff --git a/node_modules/npm-user-validate/test/email.test.js b/node_modules/npm-user-validate/test/email.test.js new file mode 100644 index 000000000..1060a9354 --- /dev/null +++ b/node_modules/npm-user-validate/test/email.test.js @@ -0,0 +1,26 @@ +var test = require('tap').test +var v = require('../npm-user-validate.js').email + +test('email misses an @', function (t) { + err = v('namedomain') + t.type(err, 'object') + t.end() +}) + +test('email misses a dot', function (t) { + err = v('name@domain') + t.type(err, 'object') + t.end() +}) + +test('email misses a string before the @', function (t) { + err = v('@domain') + t.type(err, 'object') + t.end() +}) + +test('email is ok', function (t) { + err = v('name@domain.com') + t.type(err, 'null') + t.end() +})
\ No newline at end of file diff --git a/node_modules/npm-user-validate/test/pw.test.js b/node_modules/npm-user-validate/test/pw.test.js new file mode 100644 index 000000000..e99c991cb --- /dev/null +++ b/node_modules/npm-user-validate/test/pw.test.js @@ -0,0 +1,32 @@ +var test = require('tap').test +var v = require('../npm-user-validate.js').pw + +test('pw contains a \'', function (t) { + err = v('\'') + t.type(err, 'object') + t.end() +}) + +test('pw contains a :', function (t) { + err = v(':') + t.type(err, 'object') + t.end() +}) + +test('pw contains a @', function (t) { + err = v('@') + t.type(err, 'object') + t.end() +}) + +test('pw contains a "', function (t) { + err = v('"') + t.type(err, 'object') + t.end() +}) + +test('pw is ok', function (t) { + err = v('duck') + t.type(err, 'null') + t.end() +})
\ No newline at end of file diff --git a/node_modules/npm-user-validate/test/username.test.js b/node_modules/npm-user-validate/test/username.test.js new file mode 100644 index 000000000..d30ec8afe --- /dev/null +++ b/node_modules/npm-user-validate/test/username.test.js @@ -0,0 +1,26 @@ +var test = require('tap').test +var v = require('../npm-user-validate.js').username + +test('username must be lowercase', function (t) { + err = v('ERRR') + t.type(err, 'object') + t.end() +}) + +test('username may not contain non-url-safe chars', function (t) { + err = v('f ') + t.type(err, 'object') + t.end() +}) + +test('username may not start with "."', function (t) { + err = v('.username') + t.type(err, 'object') + t.end() +}) + +test('username is ok', function (t) { + err = v('ente') + t.type(err, 'null') + t.end() +}) |