Skip to content

Commit

Permalink
🧹 add tests for AdjustRiskScore in arbitrary order (#1232)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Apr 5, 2024
1 parent 2cb0615 commit 2d9bec6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions policy/risk_factor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,27 @@ func TestRiskFactor_Checksums(t *testing.T) {
}
}

func TestRiskFactor_AdjustRiskScoreMultiple(t *testing.T) {
rfs := []*RiskFactor{
{Magnitude: 0.2},
{Magnitude: 0.3},
{Magnitude: 0.4},
}
a := &Score{RiskScore: 20}
rfs[0].AdjustRiskScore(a, true)
rfs[1].AdjustRiskScore(a, true)
rfs[2].AdjustRiskScore(a, true)

b := &Score{RiskScore: 20}
rfs[2].AdjustRiskScore(b, true)
rfs[1].AdjustRiskScore(b, true)
rfs[0].AdjustRiskScore(b, true)

a.RiskFactors = nil
b.RiskFactors = nil
assert.Equal(t, a, b)
}

func TestRiskFactor_AdjustRiskScore(t *testing.T) {
tests := []struct {
risk RiskFactor
Expand Down

0 comments on commit 2d9bec6

Please sign in to comment.