Score as percentages

This commit is contained in:
nemunaire 2025-10-21 12:52:20 +07:00
commit 74aee54432
23 changed files with 1027 additions and 1488 deletions

View file

@ -267,19 +267,19 @@ func TestGetBlacklistScore(t *testing.T) {
tests := []struct {
name string
results *RBLResults
expectedScore float32
expectedScore int
}{
{
name: "Nil results",
results: nil,
expectedScore: 20.0,
expectedScore: 200,
},
{
name: "No IPs checked",
results: &RBLResults{
IPsChecked: []string{},
},
expectedScore: 20.0,
expectedScore: 200,
},
{
name: "Not listed on any RBL",
@ -287,7 +287,7 @@ func TestGetBlacklistScore(t *testing.T) {
IPsChecked: []string{"198.51.100.1"},
ListedCount: 0,
},
expectedScore: 20.0,
expectedScore: 200,
},
{
name: "Listed on 1 RBL",
@ -295,7 +295,7 @@ func TestGetBlacklistScore(t *testing.T) {
IPsChecked: []string{"198.51.100.1"},
ListedCount: 1,
},
expectedScore: 10.0,
expectedScore: 100,
},
{
name: "Listed on 2 RBLs",
@ -303,7 +303,7 @@ func TestGetBlacklistScore(t *testing.T) {
IPsChecked: []string{"198.51.100.1"},
ListedCount: 2,
},
expectedScore: 5.0,
expectedScore: 50,
},
{
name: "Listed on 3 RBLs",
@ -311,7 +311,7 @@ func TestGetBlacklistScore(t *testing.T) {
IPsChecked: []string{"198.51.100.1"},
ListedCount: 3,
},
expectedScore: 5.0,
expectedScore: 50,
},
{
name: "Listed on 4+ RBLs",
@ -319,7 +319,7 @@ func TestGetBlacklistScore(t *testing.T) {
IPsChecked: []string{"198.51.100.1"},
ListedCount: 4,
},
expectedScore: 0.0,
expectedScore: 0,
},
}
@ -340,7 +340,7 @@ func TestGenerateSummaryCheck(t *testing.T) {
name string
results *RBLResults
expectedStatus api.CheckStatus
expectedScore float32
expectedScore int
}{
{
name: "Not listed",
@ -350,7 +350,7 @@ func TestGenerateSummaryCheck(t *testing.T) {
Checks: make([]RBLCheck, 6), // 6 default RBLs
},
expectedStatus: api.CheckStatusPass,
expectedScore: 20.0,
expectedScore: 200,
},
{
name: "Listed on 1 RBL",
@ -360,7 +360,7 @@ func TestGenerateSummaryCheck(t *testing.T) {
Checks: make([]RBLCheck, 6),
},
expectedStatus: api.CheckStatusWarn,
expectedScore: 10.0,
expectedScore: 100,
},
{
name: "Listed on 2 RBLs",
@ -370,7 +370,7 @@ func TestGenerateSummaryCheck(t *testing.T) {
Checks: make([]RBLCheck, 6),
},
expectedStatus: api.CheckStatusWarn,
expectedScore: 5.0,
expectedScore: 50,
},
{
name: "Listed on 4+ RBLs",
@ -380,7 +380,7 @@ func TestGenerateSummaryCheck(t *testing.T) {
Checks: make([]RBLCheck, 6),
},
expectedStatus: api.CheckStatusFail,
expectedScore: 0.0,
expectedScore: 0,
},
}