Skip to content

Instantly share code, notes, and snippets.

@yemel
Created April 8, 2014 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yemel/10114580 to your computer and use it in GitHub Desktop.
Save yemel/10114580 to your computer and use it in GitHub Desktop.
var auth = require('./auth.js')
function testAuthentication(username, password) {
auth.authenticateUser(username, password, function onResult(isAuthenticated){
console.log(username + ' can authenticate with '+ password
+ ' --> ' + isAuthenticated);
});
}
function runTest(){
auth.addUser('test-user', 'my password', function testUser() {
testAuthentication('test-user', 'my password');
testAuthentication('test-user', 'bad password');
});
testAuthentication('invalid-user', 'something');
}
auth.purgeDatabase(runTest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment