fix: better enabled/disabled/onboarding/unknown status

This commit is contained in:
Rhys Arkins 2018-07-19 08:54:15 +02:00
parent f37d1fd515
commit 449f72131b

View file

@ -2,8 +2,7 @@ module.exports = {
processResult, processResult,
}; };
function processResult(config, result) { function processResult(config, res) {
let res = result;
const disabledStatuses = [ const disabledStatuses = [
'archived', 'archived',
'blocked', 'blocked',
@ -15,23 +14,16 @@ function processResult(config, result) {
'renamed', 'renamed',
'uninitiated', 'uninitiated',
]; ];
const errorStatuses = [
'config-validation',
'error',
'unknown-error',
'not-found',
];
let status; let status;
// istanbul ignore next // istanbul ignore next
if (disabledStatuses.includes(res)) { if (disabledStatuses.includes(res)) {
status = 'disabled'; status = 'disabled';
} else if (errorStatuses.includes(res)) {
status = 'error';
} else if (config.repoIsOnboarded) { } else if (config.repoIsOnboarded) {
status = 'enabled'; status = 'enabled';
} else { } else if (config.repoIsOnboarded === false) {
status = 'onboarding'; status = 'onboarding';
res = 'done'; } else {
status = 'unknown';
} }
return { res, status }; return { res, status };
} }