larvituser
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -347,2 +347,5 @@ 'use strict'; | ||
if (typeof username !== 'string') return cb(new Error('Username must be a string'), false); | ||
if (typeof password !== 'string') return cb(new Error('Password must be a string'), false); | ||
username = username.trim(); | ||
@@ -349,0 +352,0 @@ password = password.trim(); |
{ | ||
"name": "larvituser", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"author": { | ||
@@ -22,3 +22,3 @@ "name": "Mikael 'Lilleman' Göransson", | ||
"freeport": "1.0.5", | ||
"mocha": "6.1.4", | ||
"mocha": "6.2.2", | ||
"mocha-eslint": "5.0.0" | ||
@@ -25,0 +25,0 @@ }, |
@@ -56,2 +56,7 @@ 'use strict'; | ||
// Clear DB | ||
tasks.push(function (cb) { | ||
db.removeAllTables(cb); | ||
}); | ||
// Check for empty db | ||
@@ -206,2 +211,19 @@ tasks.push(function (cb) { | ||
it('should fail to log in user if username is an array', function (done) { | ||
userLib.fromUserAndPass(['lill', 'eman'], 'foobar', function (err, user) { | ||
assert(err.message === 'Username must be a string', 'Error should be "Username must be a string"'); | ||
assert(user === false, 'user should be false'); | ||
done(); | ||
}); | ||
}); | ||
it('should fail to log in user if password is an array', function (done) { | ||
userLib.fromUserAndPass('lilleman', ['foo', 'bar'], function (err, user) { | ||
assert(err.message === 'Password must be a string', 'Error should be "Password must be a string"'); | ||
assert(user === false, 'user should be false'); | ||
done(); | ||
}); | ||
}); | ||
it('should log in user by field', function (done) { | ||
@@ -208,0 +230,0 @@ userLib.fromField('firstname', 'migal', function (err, user) { |
89986
2413