From 90cfe2417df7074d13fc81c2af25ae1052e33432 Mon Sep 17 00:00:00 2001 From: rachael-oregan Date: Wed, 30 Nov 2016 11:33:48 +0000 Subject: [PATCH] RHMAP-11703 - function refactor --- lib/auth.js | 12 ++++++------ test/test_fhauth.js | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/auth.js b/lib/auth.js index 6a33873..1ff2cc9 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -54,16 +54,16 @@ var auth = { } }, /** - * @param {object} req - * @param {object} res - * @param {object} cb * New endpoint required as autentication ($fh.auth) requests not handled - * correctly in local development/Studio Preview - + * correctly in local development/Studio Preview - * the js sdk dertermines envrironment mode from url string. - * New endpoint determines environment mode from env var, + * New endpoint determines environment mode from env var, * sends request (req) and calls user provided function (cb). + * @param {object} req + * @param {object} res + * @param {object} cb */ - getEnvironmentMode: function (req, res, cb) { + performAuth: function (req, res, cb) { // "FH_USE_LOCAL_DB" env var determines if the app is running in local mode. if (process.env.FH_USE_LOCAL_DB) { // In local mode, invoke user function diff --git a/test/test_fhauth.js b/test/test_fhauth.js index fc60a1f..483a4d1 100644 --- a/test/test_fhauth.js +++ b/test/test_fhauth.js @@ -21,13 +21,13 @@ module.exports = { /** * @param {object} finish */ - getEnvModeLocal : function(finish) { + performAuthLocalDev : function(finish) { process.env.FH_USE_LOCAL_DB = 'true'; var req = _.noop; var res = {body: 'test'}; - $fh.auth.getEnvironmentMode(req, res, function(err, resp) { + $fh.auth.performAuth(req, res, function(err, resp) { assert.notEqual(resp.body, 'productionMode'); finish(); }); @@ -36,13 +36,13 @@ module.exports = { /** * @param {object} finish */ - getEnvModeRemote: function(finish) { + performAuthProductionDev: function(finish) { process.env.FH_USE_LOCAL_DB = ''; var req = {body: 'test'}; var res = _.noop; - $fh.auth.getEnvironmentMode(req, res, function(err, resp) { + $fh.auth.performAuth(req, res, function(err, resp) { assert.equal(resp.body, 'productionMode') finish(); });