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