Permalink
Browse files

Stylistic edits for applied patch.

  • Loading branch information...
1 parent 179a2aa commit d781c14d5482b839706c95acf89efc138d3a29bf @jaredhanson committed Jun 26, 2012
Showing with 12 additions and 20 deletions.
  1. +2 −1 lib/passport-facebook/strategy.js
  2. +10 −19 test/strategy-test.js
@@ -56,7 +56,8 @@ function Strategy(options, verify) {
util.inherits(Strategy, OAuth2Strategy);
/**
- * Return extra parameters to be included in the authorization request.
+ * Return extra Facebook-specific parameters to be included in the authorization
+ * request.
*
* Options:
* - `display` Display mode to render dialog, { `page`, `popup`, `touch` }.
View
@@ -1,7 +1,7 @@
var vows = require('vows');
var assert = require('assert');
var util = require('util');
-var urlLib = require('url');
+var url = require('url');
var FacebookStrategy = require('passport-facebook/strategy');
@@ -21,7 +21,7 @@ vows.describe('FacebookStrategy').addBatch({
},
},
- 'strategy when loading authorization url': {
+ 'strategy when redirecting for authorization': {
topic: function () {
var strategy = new FacebookStrategy({
clientID: 'ABC123',
@@ -37,19 +37,15 @@ vows.describe('FacebookStrategy').addBatch({
url;
// Stub strategy.redirect()
+ var self = this;
strategy.redirect = function (location) {
- url = location;
-
- return location;
+ self.callback(null, location)
};
strategy.authenticate(mockRequest);
-
- return url;
},
- 'does not set authorization param': function(url) {
- var params = urlLib.parse(url, true).query;
-
+ 'does not set authorization param': function(err, location) {
+ var params = url.parse(location, true).query;
assert.isUndefined(params.display);
}
},
@@ -60,20 +56,15 @@ vows.describe('FacebookStrategy').addBatch({
url;
// Stub strategy.redirect()
+ var self = this;
strategy.redirect = function (location) {
- url = location;
-
- return location;
+ self.callback(null, location)
};
strategy.authenticate(mockRequest, { display: 'mobile' });
-
- return url;
},
-
- 'sets authorization param to mobile': function(url) {
- var params = urlLib.parse(url, true).query;
-
+ 'sets authorization param to mobile': function(err, location) {
+ var params = url.parse(location, true).query;
assert.equal(params.display, 'mobile');
}
}

0 comments on commit d781c14

Please sign in to comment.