Tag: facebook test users

用摩卡testingFacebook应用程序

我正在开发一个使用Facebooklogin的node.js应用程序,我正在尝试使用mocha进行单元和集成testing。 所以在一个函数,我有这个代码为了login: exports.loginFacebook = function (done){ request({uri:"https://graph.facebook.com//oauth/access_token?client_id={app-id}&client_secret={app-secret}&grant_type=client_credentials", method: "GET", timeout: reqOpts.timeout}, function(err, res, body) { if(err){ throw err; } else{ uri2 = "https://graph.facebook.com/APP_ID/accounts/test-users?"+String(body); request({uri:uri2, method: "GET", timeout: reqOpts.timeout}, function(err, res, body) { if(err){ throw err; } else{ login_url = JSON.parse(body).data[0].login_url console.log(login_url); request({uri:login_url, method: "GET", timeout: reqOpts.timeout}, function(err, res, body) { if(err){ throw err; } else{ […]