facebook-node-sdk
Advanced tools
Comparing version 0.1.9 to 0.1.10
var https = require('https'); | ||
var assert = require('assert'); | ||
var crypto = require('crypto'); | ||
@@ -508,3 +509,4 @@ var util = require('util'); | ||
var user = signedRequest.user_id; | ||
this.setPersistentData('user_id', signedRequest.user_id); | ||
assert.ok(typeof user === 'string' && user.match(/^\d+$/)); | ||
this.setPersistentData('user_id', user); | ||
callback(null, user); | ||
@@ -545,2 +547,3 @@ callback = null; | ||
if (user) { | ||
assert.ok(typeof user === 'string' && user.match(/^\d+$/)); | ||
self.setPersistentData('user_id', user); | ||
@@ -547,0 +550,0 @@ } else { |
@@ -22,3 +22,3 @@ var util = require('util'); | ||
} | ||
return false; | ||
return defaultValue; | ||
}; | ||
@@ -25,0 +25,0 @@ |
{ | ||
"name": "facebook-node-sdk", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "Node.js SDK for the Facebook API", | ||
@@ -12,3 +12,3 @@ "tags": ["facebook"], | ||
"scripts": { | ||
"test": "TEST_FB_APP_ID=227710073967374 TEST_FB_SECRET=a25a2216fb1b772f1c554ebb9d950aec node_modules/.bin/expresso test/*" | ||
"test": "node_modules/.bin/expresso" | ||
}, | ||
@@ -15,0 +15,0 @@ "bugs": { |
var path = require('path'); | ||
var util = require('util'); | ||
var assert = require('assert'); | ||
var url = require('url'); | ||
var fs = require('fs'); | ||
var testUtil = require('./lib/testutil.js'); | ||
var basedir = path.join(__dirname, '..'); | ||
var covdir = path.join(basedir, 'lib-cov'); | ||
var libdir = path.join(basedir, 'lib'); | ||
var BaseFacebook = require(path.join(testUtil.libdir, 'basefacebook.js')); | ||
try { | ||
var stat = fs.statSync(covdir); | ||
if (stat.isDirectory()) { | ||
libdir = covdir; | ||
} | ||
} | ||
catch (e) { | ||
} | ||
var config = testUtil.fbDefaultConfig; | ||
var BaseFacebook = require(path.join(libdir, 'basefacebook.js')); | ||
assert.ok('TEST_FB_APP_ID' in process.env); | ||
assert.ok('TEST_FB_SECRET' in process.env); | ||
var config = { | ||
appId: process.env.TEST_FB_APP_ID, | ||
secret: process.env.TEST_FB_SECRET | ||
}; | ||
module.exports = { | ||
@@ -31,0 +11,0 @@ |
var path = require('path'); | ||
var fs = require('fs'); | ||
var assert = require('assert'); | ||
var express = require('express'); | ||
var testUtil = require('./lib/testutil.js'); | ||
var basedir = path.join(__dirname, '..'); | ||
var covdir = path.join(basedir, 'lib-cov'); | ||
var libdir = path.join(basedir, 'lib'); | ||
var Facebook = require(path.join(testUtil.libdir, 'facebook.js')); | ||
try { | ||
var stat = fs.statSync(covdir); | ||
if (stat.isDirectory()) { | ||
libdir = covdir; | ||
} | ||
} | ||
catch (e) { | ||
} | ||
var config = testUtil.fbDefaultConfig; | ||
var Facebook = require(path.join(libdir, 'facebook.js')); | ||
assert.ok('TEST_FB_APP_ID' in process.env); | ||
assert.ok('TEST_FB_SECRET' in process.env); | ||
var config = { | ||
appId: process.env.TEST_FB_APP_ID, | ||
secret: process.env.TEST_FB_SECRET | ||
}; | ||
module.exports = { | ||
@@ -60,2 +40,27 @@ | ||
getPersistentData: function(beforeExit, assert) { | ||
var done = false; | ||
beforeExit(function() { assert.ok(done) }); | ||
var app = express.createServer(); | ||
app.configure(function () { | ||
app.use(express.bodyParser()); | ||
app.use(express.cookieParser()); | ||
app.use(Facebook.middleware(config)); | ||
}); | ||
// When there is no session, getPersistentData return defaultValue | ||
app.get('/', function(req, res) { | ||
var user = req.facebook.getPersistentData('user_id', 0); | ||
res.send(JSON.stringify(user)); | ||
}); | ||
assert.response(app, { url: '/' }, function(res) { | ||
assert.equal(res.body, '0'); | ||
done = true; | ||
}); | ||
done = true; | ||
}, | ||
middleware: function(beforeExit, assert) { | ||
@@ -108,2 +113,3 @@ var done = false; | ||
assert.equal(res.statusCode, 302); | ||
done = true; | ||
@@ -110,0 +116,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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
93698
12
2710
10