(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func Test_calculateSeverity(t *testing.T) { |
| 69 | t.Parallel() |
| 70 | |
| 71 | for _, tt := range []struct { |
| 72 | total int |
| 73 | healthy int |
| 74 | warning int |
| 75 | expected health.Severity |
| 76 | }{ |
| 77 | {0, 0, 0, health.SeverityOK}, |
| 78 | {1, 1, 0, health.SeverityOK}, |
| 79 | {1, 1, 1, health.SeverityWarning}, |
| 80 | {1, 0, 0, health.SeverityError}, |
| 81 | {2, 2, 0, health.SeverityOK}, |
| 82 | {2, 1, 0, health.SeverityWarning}, |
| 83 | {2, 1, 1, health.SeverityWarning}, |
| 84 | {2, 0, 0, health.SeverityError}, |
| 85 | {2, 0, 1, health.SeverityError}, |
| 86 | } { |
| 87 | name := fmt.Sprintf("%d total, %d healthy, %d warning -> %s", tt.total, tt.healthy, tt.warning, tt.expected) |
| 88 | t.Run(name, func(t *testing.T) { |
| 89 | t.Parallel() |
| 90 | |
| 91 | actual := calculateSeverity(tt.total, tt.healthy, tt.warning) |
| 92 | assert.Equal(t, tt.expected, actual) |
| 93 | }) |
| 94 | } |
| 95 | } |
nothing calls this directly
no test coverage detected