mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
test: expand backend coverage
This commit is contained in:
parent
3ea5f54d93
commit
7f7edfceb4
118 changed files with 21980 additions and 74 deletions
40
internal/api/ai_intelligence_helpers_additional_test.go
Normal file
40
internal/api/ai_intelligence_helpers_additional_test.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/rcourtman/pulse-go-rewrite/internal/ai"
|
||||
)
|
||||
|
||||
func TestRemediationStatsFromRecords(t *testing.T) {
|
||||
records := []ai.RemediationRecord{
|
||||
{Outcome: ai.OutcomeResolved, Automatic: true},
|
||||
{Outcome: ai.OutcomeResolved, Automatic: false},
|
||||
{Outcome: ai.OutcomePartial, Automatic: true},
|
||||
{Outcome: ai.OutcomeFailed, Automatic: false},
|
||||
{Outcome: "unknown", Automatic: true},
|
||||
}
|
||||
|
||||
stats := remediationStatsFromRecords(records)
|
||||
if stats["total"] != 5 {
|
||||
t.Fatalf("total = %d, want 5", stats["total"])
|
||||
}
|
||||
if stats["resolved"] != 2 {
|
||||
t.Fatalf("resolved = %d, want 2", stats["resolved"])
|
||||
}
|
||||
if stats["partial"] != 1 {
|
||||
t.Fatalf("partial = %d, want 1", stats["partial"])
|
||||
}
|
||||
if stats["failed"] != 1 {
|
||||
t.Fatalf("failed = %d, want 1", stats["failed"])
|
||||
}
|
||||
if stats["unknown"] != 1 {
|
||||
t.Fatalf("unknown = %d, want 1", stats["unknown"])
|
||||
}
|
||||
if stats["automatic"] != 3 {
|
||||
t.Fatalf("automatic = %d, want 3", stats["automatic"])
|
||||
}
|
||||
if stats["manual"] != 2 {
|
||||
t.Fatalf("manual = %d, want 2", stats["manual"])
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue