22 lines
540 B
Go
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)
|
|
}
|
|
}
|