Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

addressed #19 cleanup unneeded code

  • Loading branch information...
commit ea7fafbdc43690419d284ec87ba828c7edf7c40b 1 parent d4ff785
@oveddan oveddan authored
Showing with 14 additions and 20 deletions.
  1. +14 −20 test/OAuth2Provider_tests.js
View
34 test/OAuth2Provider_tests.js
@@ -2,13 +2,9 @@ var sinon = require('sinon'),
should = require('chai').should(),
serializer = require('serializer');
-describe('OAuth2Provider', function(){
- // it('should inherit from EventEmitter', function(){
- // // secure serializer
- // var oAuth2Provider = createOauth2Provider();
+var module = require('../index');
- // oAuth2Provider.should.be.an('EventEmitter');
- // });
+describe('OAuth2Provider', function(){
describe('login', function(){
beforeEach(function(){
@@ -49,7 +45,7 @@ describe('OAuth2Provider', function(){
this.oAuth2Provider.emit = sinon.spy();
// TEST
- // build arguments that are verified
+ // build arguments that are passed to middleware function
var req = {
query : {
'access_token' : access_token
@@ -92,7 +88,7 @@ describe('OAuth2Provider', function(){
};
// TEST
- // get login middle ware function, and invoke it with above arguments
+ // get login middleware function, and invoke it with above arguments
var middlewareFunction = this.oAuth2Provider.login();
middlewareFunction(req, res);
@@ -101,16 +97,14 @@ describe('OAuth2Provider', function(){
res.end.calledWith(errorMessage).should.be.ok;
});
});
+});
+
+
+
+// utility methods
+var createOauth2Provider = function(crypt_key, sign_key){
+ var crypt_key = crypt_key || '123131',
+ sign_key = sign_key || 'asdfasdfas';
- // utility methods
- var createOauth2Provider = function(crypt_key, sign_key){
- var crypt_key = crypt_key || '123131',
- sign_key = sign_key || 'asdfasdfas';
-
- // requiring this needs module needs to be done repeatedly, since it depends on a static serializer
- // factory in its static constructuro, which needs to be stubbed by many of the methods
- var module = require('../index'),
- oAuth2Provider = new module.OAuth2Provider(crypt_key, sign_key);
- return oAuth2Provider;
- };
-});
+ return new module.OAuth2Provider(crypt_key, sign_key);
+};
Please sign in to comment.
Something went wrong with that request. Please try again.