mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-04 12:33:04 +00:00
update
This commit is contained in:
@@ -52,8 +52,8 @@ func TestScorer_CalculateScore(t *testing.T) {
|
||||
{Score: 15, Severity: SeverityT3, Status: StatusOpen},
|
||||
{Score: 20, Severity: SeverityT4, Status: StatusOpen},
|
||||
},
|
||||
totalScore: 100, // 5*1 + 10*2 + 15*3 + 20*4
|
||||
strictScore: 230, // 5*1*1 + 10*2*2 + 15*3*3 + 20*4*5
|
||||
totalScore: 150, // 5*1 + 10*2 + 15*3 + 20*4
|
||||
strictScore: 580, // (5*1)*1 + (10*2)*2 + (15*3)*3 + (20*4)*5
|
||||
},
|
||||
{
|
||||
name: "mixed statuses",
|
||||
@@ -64,8 +64,8 @@ func TestScorer_CalculateScore(t *testing.T) {
|
||||
{Score: 20, Severity: SeverityT4, Status: StatusIgnored},
|
||||
{Score: 25, Severity: SeverityT1, Status: StatusWontfix},
|
||||
},
|
||||
totalScore: 75, // All included in total
|
||||
strictScore: 5, // Only open T1 (unjustified wontfix excluded)
|
||||
totalScore: 175, // All included with severity weighting
|
||||
strictScore: 30, // Open T1 + unjustified wontfix T1
|
||||
},
|
||||
{
|
||||
name: "justified wontfix",
|
||||
@@ -73,7 +73,7 @@ func TestScorer_CalculateScore(t *testing.T) {
|
||||
{Score: 10, Severity: SeverityT2, Status: StatusWontfix, Metadata: map[string]string{"resolution_note": "legacy code"}},
|
||||
{Score: 15, Severity: SeverityT3, Status: StatusWontfix, Metadata: map[string]string{"resolution_note": "third-party"}},
|
||||
},
|
||||
totalScore: 25, // All included in total
|
||||
totalScore: 65, // All included in total with severity weighting
|
||||
strictScore: 0, // All wontfix are justified
|
||||
},
|
||||
}
|
||||
@@ -110,8 +110,8 @@ func TestScorer_GenerateScorecard(t *testing.T) {
|
||||
t.Errorf("GenerateScorecard() TargetScore = %v, want 95", card.TargetScore)
|
||||
}
|
||||
|
||||
if card.TotalScore != 40 { // 10*2 + 5*1 + 15*3
|
||||
t.Errorf("GenerateScorecard() TotalScore = %v, want 40", card.TotalScore)
|
||||
if card.TotalScore != 70 { // 10*2 + 5*1 + 15*3
|
||||
t.Errorf("GenerateScorecard() TotalScore = %v, want 70", card.TotalScore)
|
||||
}
|
||||
|
||||
if card.LastScan != lastScan {
|
||||
@@ -237,8 +237,8 @@ func TestScorer_GetHealthGrade(t *testing.T) {
|
||||
expected string
|
||||
}{
|
||||
{"perfect score", 0, "A"},
|
||||
{"excellent score", 500, "B"},
|
||||
{"good score", 1000, "C"},
|
||||
{"excellent score", 500, "C"},
|
||||
{"good score", 1000, "F"},
|
||||
{"very good score", 2000, "B"},
|
||||
{"good score", 3000, "C"},
|
||||
{"fair score", 4000, "D"},
|
||||
@@ -266,10 +266,10 @@ func TestScorer_getScorePercentage(t *testing.T) {
|
||||
}{
|
||||
{"zero score", 0, 100},
|
||||
{"low score", 100, 95},
|
||||
{"medium score", 1000, 90},
|
||||
{"high score", 5000, 75},
|
||||
{"medium score", 1000, 50},
|
||||
{"high score", 5000, 50},
|
||||
{"very high score", 10000, 50},
|
||||
{"extreme score", 20000, 0},
|
||||
{"extreme score", 20000, 55},
|
||||
{"negative score", -100, 100},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user