Skip to content

Commit

Permalink
fix(utils): prevent mixed summary when some audit changed only value
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Mar 19, 2024
1 parent d4668df commit 20673fd
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/utils/src/lib/reports/generate-md-reports-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,15 @@ function changesToDiffOutcomes(changes: Change[]): DiffOutcome[] {
}

function mergeDiffOutcomes(outcomes: DiffOutcome[]): DiffOutcome {
if (outcomes.length === 0) {
if (outcomes.every(outcome => outcome === 'unchanged')) {
return 'unchanged';
}
if (
outcomes.every(outcome => outcome === 'positive' || outcome === 'unchanged')
) {
if (outcomes.includes('positive') && !outcomes.includes('negative')) {
return 'positive';
}
if (
outcomes.every(outcome => outcome === 'negative' || outcome === 'unchanged')
) {
if (outcomes.includes('negative') && !outcomes.includes('positive')) {
return 'negative';
}
if (outcomes.every(outcome => outcome === 'unchanged')) {
return 'unchanged';
}
return 'mixed';
}

Expand Down

0 comments on commit 20673fd

Please sign in to comment.