Builds: design 47 G §692, §668 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
package index
|
|
|
|
import (
|
|
"encoding/json"
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// Design 47 G §668, §692: manifest-accepted's problems are the validator's strings, the same the verdict writes as
|
|
// warnings, in the same order; a mended manifest says an empty list, never null.
|
|
func TestManifestAcceptedProblemsAreTheVerdictsWarnings(t *testing.T) {
|
|
warnings := []string{`requires "amqp", which no module provides`, "a second problem"}
|
|
got := acceptedOf("sha256:aa", meshcatalog.VerdictsByDigestValue{Module: "m", Judge: "j", Warnings: warnings}, 3, []byte(`{"module":"m","version":"1.0"}`))
|
|
if !reflect.DeepEqual(got.Problems, warnings) {
|
|
t.Errorf("problems %v, want the verdict's warnings %v", got.Problems, warnings)
|
|
}
|
|
mended := acceptedOf("sha256:bb", meshcatalog.VerdictsByDigestValue{Module: "m", Judge: "j"}, 4, []byte(`{"module":"m","version":"2.0"}`))
|
|
raw, _ := json.Marshal(mended)
|
|
if !strings.Contains(string(raw), `"problems":[]`) {
|
|
t.Errorf("a mended manifest's event is %s, want an empty problems list", raw)
|
|
}
|
|
}
|