Add source bundle validation and inspection
This commit is contained in:
21
internal/bundle/digest_test.go
Normal file
21
internal/bundle/digest_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package bundle
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCanonicalBundleDigestReferenceFixture(t *testing.T) {
|
||||
manifest, err := ParseManifest(readFixture(t, "testdata/valid_bundle/manifest.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("ParseManifest() error = %v", err)
|
||||
}
|
||||
gotPayload := CanonicalFilePayload(manifest.Files)
|
||||
wantPayload := strings.TrimSpace(string(readFixture(t, "testdata/canonical_payload.json")))
|
||||
if gotPayload != wantPayload {
|
||||
t.Fatalf("canonical payload = %q, want %q", gotPayload, wantPayload)
|
||||
}
|
||||
if got, want := BundleDigest(manifest.Files), manifest.Digest; got != want {
|
||||
t.Fatalf("BundleDigest() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user