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