facebook-node-sdk
Advanced tools
Comparing version 0.1.7 to 0.1.9
@@ -136,6 +136,19 @@ var https = require('https'); | ||
*/ | ||
BaseFacebook.prototype.useFileUploadSupport = function() { | ||
BaseFacebook.prototype.getFileUploadSupport = function() { | ||
return this.fileUploadSupport; | ||
}; | ||
/** | ||
* DEPRECATED! Please use getFileUploadSupport instead. | ||
* | ||
* Get the file upload support status. | ||
* | ||
* @return boolean true if and only if the server supports file upload. | ||
*/ | ||
BaseFacebook.prototype.useFileUploadSupport = function() { | ||
return this.getFileUploadSupport(); | ||
} | ||
BaseFacebook.prototype.accessToken = null; | ||
@@ -427,9 +440,3 @@ | ||
if (param !== null) { | ||
try { | ||
this.signedRequest = this.parseSignedRequest(param); | ||
} | ||
catch (err) { | ||
this.signedRequest = null; | ||
this.errorLog('Parse error sigened_request parameter: ' + param); | ||
} | ||
parseSignedRequestWrapped(this, param); | ||
} | ||
@@ -440,12 +447,17 @@ if (this.signedRequest === null) { | ||
if (cookieValue !== null) { | ||
try { | ||
this.signedRequest = this.parseSignedRequest(cookieValue); | ||
} | ||
catch (err) { | ||
this.signedRequest = null; | ||
this.errorLog('Parse error sigened_request cookie: ' + cookieValue); | ||
} | ||
parseSignedRequestWrapped(this, cookieValue); | ||
} | ||
} | ||
} | ||
function parseSignedRequestWrapped(self, str) { | ||
try { | ||
self.signedRequest = self.parseSignedRequest(str); | ||
} | ||
catch (err) { | ||
self.signedRequest = null; | ||
self.errorLog('Parse error sigened_request cookie: ' + str); | ||
} | ||
} | ||
return this.signedRequest; | ||
@@ -529,9 +541,15 @@ }; | ||
self.getUserFromAccessToken(function(err, user) { | ||
if (user) { | ||
self.setPersistentData('user_id', user); | ||
} else { | ||
self.clearAllPersistentData(); | ||
if (err) { | ||
callback(err, null); | ||
callback = null; | ||
} | ||
callback(null, user); | ||
callback = null; | ||
else { | ||
if (user) { | ||
self.setPersistentData('user_id', user); | ||
} else { | ||
self.clearAllPersistentData(); | ||
} | ||
callback(null, user); | ||
callback = null; | ||
} | ||
}); | ||
@@ -538,0 +556,0 @@ } |
{ | ||
"name": "facebook-node-sdk", | ||
"version": "0.1.7", | ||
"version": "0.1.9", | ||
"description": "Node.js SDK for the Facebook API", | ||
@@ -5,0 +5,0 @@ "tags": ["facebook"], |
@@ -59,2 +59,4 @@ var path = require('path'); | ||
assert.equal(facebook.getApiSecret(), config.secret, 'Expect the API secret to be set.'); | ||
assert.ok(facebook.getFileUploadSupport(), 'Expect file upload support to be on.'); | ||
// alias (depricated) for getFileUploadSupport -- test until removed | ||
assert.ok(facebook.useFileUploadSupport(), 'Expect file upload support to be on.'); | ||
@@ -112,4 +114,8 @@ done = true; | ||
}); | ||
assert.equal(facebook.getFileUploadSupport(), false, 'Expect file upload support to be off.'); | ||
// alias for getFileUploadSupport (depricated), testing until removed | ||
assert.equal(facebook.useFileUploadSupport(), false, 'Expect file upload support to be off.'); | ||
facebook.setFileUploadSupport(true); | ||
assert.ok(facebook.getFileUploadSupport(), 'Expect file upload support to be on.'); | ||
// alias for getFileUploadSupport (depricated), testing until removed | ||
assert.ok(facebook.useFileUploadSupport(), 'Expect file upload support to be on.'); | ||
@@ -849,3 +855,26 @@ done = true; | ||
assert.notEqual(url.indexOf(encodedUrl), -1, 'Expect the current url to exist.'); | ||
done = true; | ||
var facebook = new TransientFacebook({ | ||
appId: 'dummy', | ||
secret: 'dummy' | ||
}); | ||
facebook.getUserAccessToken = function(callback) { | ||
callback(new Error('dummy-error'), null); | ||
}; | ||
facebook.getLogoutUrl(function(err, url) { | ||
assert.notEqual(err, null); | ||
assert.equal(err.message, 'dummy-error'); | ||
assert.equal(url, null); | ||
var facebook = new TransientFacebook({ | ||
appId: 'dummy', | ||
secret: 'dummy' | ||
}); | ||
facebook.getLogoutUrl(function(err, url) { | ||
assert.notEqual(err, null); | ||
assert.equal(err.message, 'No request object.'); | ||
assert.equal(url, null); | ||
done = true; | ||
}); | ||
}); | ||
}); | ||
@@ -1019,2 +1048,15 @@ }, | ||
assert.deepEqual(facebook.getSignedRequest(), payload); | ||
var facebook = new TransientFacebook({ | ||
appId: '117743971608120', | ||
secret: '943716006e74d9b9283d4d5d8ab93204', | ||
request: { | ||
body: { | ||
signed_request: 'dummy' | ||
} | ||
} | ||
}); | ||
facebook.errorLog = function() {}; | ||
assert.equal(facebook.getSignedRequest(), null); | ||
done = true; | ||
@@ -1107,3 +1149,6 @@ }, | ||
assert.equal('12345', user, 'Get user id from persistent store.'); | ||
done = true; | ||
facebook.getUser(function(err, user) { | ||
assert.equal('12345', user, 'Get user again'); | ||
done = true; | ||
}); | ||
}); | ||
@@ -1157,2 +1202,40 @@ }); | ||
getUserWithAvailableDataError: function(beforeExit, assert) { | ||
var done = false; | ||
beforeExit(function() { assert.ok(done) }); | ||
var facebook = new TransientFacebook({ | ||
appId: config.appId, | ||
secret: config.secret | ||
}); | ||
facebook.getUserFromAvailableData = function(callback) { | ||
callback(new Error('dummy'), null); | ||
}; | ||
facebook.getUser(function(err, user) { | ||
assert.notEqual(err, null); | ||
assert.equal(err.message, 'dummy'); | ||
assert.equal(user, null); | ||
done = true; | ||
}); | ||
}, | ||
getAccessTokenWithUserAccessTokenError: function(beforeExit, assert) { | ||
var done = false; | ||
beforeExit(function() { assert.ok(done) }); | ||
var facebook = new TransientFacebook({ | ||
appId: 'dummy', | ||
secret: 'secret-dummy' | ||
}); | ||
facebook.getUserAccessToken = function(callback) { | ||
callback(new Error('dummy-error'), null); | ||
}; | ||
facebook.getAccessToken(function(err, accessToken) { | ||
assert.notEqual(err, null); | ||
assert.equal(err.message, 'dummy-error'); | ||
assert.equal(accessToken, null); | ||
done = true; | ||
}); | ||
}, | ||
getUserAccessToken: function(beforeExit, assert) { | ||
@@ -1342,3 +1425,32 @@ var done = false; | ||
assert.equal(user, 0); | ||
done = true; | ||
facebook = new TransientFacebook({ | ||
appId: config.appId, | ||
secret: config.secret, | ||
request: { | ||
connection: {}, | ||
headers: {}, | ||
body: {} | ||
}, | ||
store: { | ||
access_token: 'dummy_access_token' | ||
} | ||
}); | ||
facebook.getUserFromAccessToken = function(callback) { | ||
callback(new Error('error-message'), null); | ||
}; | ||
facebook.getUserFromAvailableData(function(err, user) { | ||
assert.notEqual(err, null); | ||
assert.equal(err.message, 'error-message'); | ||
assert.equal(user, null); | ||
facebook.getUserFromAccessToken = function(callback) { | ||
callback(null, '1323'); | ||
}; | ||
facebook.getUserFromAvailableData(function(err, user) { | ||
assert.equal(err, null); | ||
assert.equal(user, '1323'); | ||
done = true; | ||
}); | ||
}); | ||
}); | ||
@@ -1345,0 +1457,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93040
2697