Files
knowledge-governance/internal/governance/source_catalog_json_test.go
T
2026-10-26 18:42:47 +08:00

22 lines
540 B
Go

package governance
import (
"encoding/json"
"testing"
)
func TestQueuedCatalogSourceIncludesNumericZeroProgress(t *testing.T) {
source := CatalogSource{SnapshotStatus: "scanning", ScanProgress: 0}
body, err := json.Marshal(source)
if err != nil {
t.Fatal(err)
}
var decoded map[string]any
if err = json.Unmarshal(body, &decoded); err != nil {
t.Fatal(err)
}
if value, ok := decoded["scan_progress"]; !ok || value != float64(0) {
t.Fatalf("queued source must satisfy the frontend numeric progress contract: %s", body)
}
}