Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snowystinger committed Sep 20, 2024
1 parent 49fc0fd commit 318da2f
Show file tree
Hide file tree
Showing 9 changed files with 6,624 additions and 7,599 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false
},
env: {
node: true
node: true,
jest: true
},
extends: 'standard',
rules: {
Expand Down
5 changes: 4 additions & 1 deletion checker/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const fetch = require('node-fetch');
const github_app = require('github-app');
const openwhisk = require('openwhisk');
const utils = require('../utils.js');
Expand Down Expand Up @@ -151,6 +150,7 @@ async function check_cla (ow, args) {
} catch (e) {
return utils.action_error(e, 'Error during retrieval of Adobe Sign access token.');
}

const access_token = response.access_token;
if (!access_token) {
return { statusCode: 500, body: 'Empty access_token retrieved from Adobe Sign.' };
Expand All @@ -174,6 +174,7 @@ async function check_cla (ow, args) {
} catch (e) {
return utils.action_error(e, 'Error retrieving Adobe Sign agreements.');
}

if (response.userAgreementList && response.userAgreementList.length) {
// We found agreements containing the github username to search through.
const agreements = response.userAgreementList.filter(function (agreement) {
Expand Down Expand Up @@ -203,6 +204,7 @@ async function check_cla (ow, args) {
} catch (e) {
return utils.action_error(e, 'Error invoking lookup action when agreements were found.');
}

const usernames = lookup_res.body.usernames;
if (usernames.map(function (item) { return item.toLowerCase(); }).includes(args.user.toLowerCase())) {
// If the username exists in the response from the lookup action, then we
Expand All @@ -228,6 +230,7 @@ async function check_cla (ow, args) {
} catch (e) {
return utils.action_error(e, 'Error invoking setgithubcheck when CLA was found.');
}

return {
statusCode: 200,
body: check_res.title
Expand Down
Loading

0 comments on commit 318da2f

Please sign in to comment.