Skip to content

Commit

Permalink
update tests to use new name key
Browse files Browse the repository at this point in the history
  • Loading branch information
zemirco committed Apr 11, 2014
1 parent db7b63f commit 7410aba
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ describe('lockit-mongodb-adapter', function() {
});
});

it('should find a user by username', function(done) {
adapter.find('username', 'john', function(err, res) {
it('should find a user by name', function(done) {
adapter.find('name', 'john', function(err, res) {
if (err) console.log(err);
res.username.should.equal('john');
res.name.should.equal('john');
res.email.should.equal('[email protected]');
done();
});
});

it('should return undefined when no user is found', function(done) {
adapter.find('username', 'jim', function(err, res) {
adapter.find('name', 'jim', function(err, res) {
if (err) console.log(err);
should.not.exist(err);
should.not.exist(res);
Expand All @@ -52,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);
res.username.should.equal('john');
res.name.should.equal('john');
res.email.should.equal('[email protected]');
done();
});
Expand All @@ -61,14 +61,14 @@ 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);
res.username.should.equal('john');
res.name.should.equal('john');
res.email.should.equal('[email protected]');
done();
});
});

it('should update an existing user', function(done) {
adapter.find('username', 'john', function(err, doc) {
adapter.find('name', 'john', function(err, doc) {
if (err) console.log(err);
doc.test = 'works';
doc.editet = true;
Expand All @@ -81,8 +81,6 @@ 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);
Expand All @@ -105,7 +103,5 @@ describe('lockit-mongodb-adapter', function() {

// remove users db
after(function(done) {

adapter.remove('john', done);

});

0 comments on commit 7410aba

Please sign in to comment.