-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
BIN = ./node_modules/.bin | ||
MOCHA = $(BIN)/mocha | ||
ESLINT = $(BIN)/eslint | ||
|
||
test: | ||
$(MOCHA) | ||
|
||
eslint: index.js ./test/*.js | ||
$(ESLINT) $^ | ||
|
||
.PHONY: test eslint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zeMirco/lockit-mongodb-adapter" | ||
"url": "https://github.com/zemirco/lockit-mongodb-adapter" | ||
}, | ||
"keywords": [ | ||
"lockit", | ||
|
@@ -18,21 +18,19 @@ | |
"author": { | ||
"name": "Mirco Zeiss", | ||
"email": "[email protected]", | ||
"twitter": "zeMirco" | ||
"twitter": "zemirco" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"node-uuid": "~1.4.1", | ||
"ms": "~0.6.2", | ||
"couch-pwd": "0.0.1", | ||
"moment": "^2.6.0", | ||
"mongodb": "^1.4.5" | ||
"mongodb": "^2.0.35", | ||
"ms": "^0.7.1", | ||
"node-uuid": "~1.4.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^0.24.0", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-mocha-test": "^0.10.2", | ||
"should": "^3.3.1" | ||
"mocha": "^2.2.5", | ||
"should": "^7.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict'; | ||
|
||
var should = require('should'); | ||
var config = require('./config.js'); | ||
|
@@ -20,7 +21,7 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should create a new user', function(done) { | ||
adapter.save('john', '[email protected]', 'secret', function(err, res) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
res.should.have.property('signupToken'); | ||
res.signupToken.should.match(/[0-9a-f]{22}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/); | ||
res.should.have.property('failedLoginAttempts'); | ||
|
@@ -33,7 +34,7 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should find a user by name', function(done) { | ||
adapter.find('name', 'john', function(err, res) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
res.name.should.equal('john'); | ||
res.email.should.equal('[email protected]'); | ||
done(); | ||
|
@@ -42,7 +43,7 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should return undefined when no user is found', function(done) { | ||
adapter.find('name', 'jim', function(err, res) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
should.not.exist(err); | ||
should.not.exist(res); | ||
done(); | ||
|
@@ -51,7 +52,7 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should find a user by email', function(done) { | ||
adapter.find('email', '[email protected]', function(err, res) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
res.name.should.equal('john'); | ||
res.email.should.equal('[email protected]'); | ||
done(); | ||
|
@@ -60,7 +61,7 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should find a user by signup token', function(done) { | ||
adapter.find('signupToken', _tmp_signupToken, function(err, res) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
res.name.should.equal('john'); | ||
res.email.should.equal('[email protected]'); | ||
done(); | ||
|
@@ -69,11 +70,11 @@ describe('lockit-mongodb-adapter', function() { | |
|
||
it('should update an existing user', function(done) { | ||
adapter.find('name', 'john', function(err, doc) { | ||
if (err) console.log(err); | ||
if (err) {console.log(err); } | ||
doc.test = 'works'; | ||
doc.editet = true; | ||
adapter.update(doc, function(err, res) { | ||
if (err) console.log(err); | ||
adapter.update(doc, function(updateErr, res) { | ||
if (updateErr) {console.log(updateErr); } | ||
res.test.should.equal('works'); | ||
res.editet.should.be.true; | ||
done(); | ||
|
@@ -82,18 +83,18 @@ describe('lockit-mongodb-adapter', function() { | |
}); | ||
|
||
it('should remove a user', function(done) { | ||
adapter.save('jeff', '[email protected]', 'secret', function(err, res) { | ||
if (err) console.log(err); | ||
adapter.remove('jeff', function(err, res) { | ||
if (err) console.log(err); | ||
adapter.save('jeff', '[email protected]', 'secret', function(err) { | ||
if (err) {console.log(err); } | ||
adapter.remove('jeff', function(removeErr, res) { | ||
if (removeErr) {console.log(removeErr); } | ||
res.should.be.true; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should return an error when remove cannot find a user', function(done) { | ||
adapter.remove('steve', function(err, res) { | ||
adapter.remove('steve', function(err) { | ||
err.message.should.equal('lockit - Cannot find user "steve"'); | ||
done(); | ||
}); | ||
|