MCPcopy Create free account
hub / github.com/conforma/cli / TestExtractImageDigest

Function TestExtractImageDigest

cmd/validate/vsa_test.go:721–755  ·  view source on GitHub ↗

TestExtractImageDigest tests the extractImageDigest function

(t *testing.T)

Source from the content-addressed store, hash-verified

719
720// TestExtractImageDigest tests the extractImageDigest function
721func TestExtractImageDigest(t *testing.T) {
722 tests := []struct {
723 name string
724 input string
725 expected string
726 }{
727 {
728 name: "sha256 digest",
729 input: "sha256:abc123def456",
730 expected: "sha256:abc123def456",
731 },
732 {
733 name: "image reference",
734 input: "nginx:latest",
735 expected: "nginx:latest",
736 },
737 {
738 name: "empty string",
739 input: "",
740 expected: "",
741 },
742 {
743 name: "image reference without digest",
744 input: "registry.io/namespace/image:tag",
745 expected: "registry.io/namespace/image:tag",
746 },
747 }
748
749 for _, tt := range tests {
750 t.Run(tt.name, func(t *testing.T) {
751 result := vsa.ExtractImageDigest(tt.input)
752 assert.Equal(t, tt.expected, result)
753 })
754 }
755}
756
757// TestConvertYAMLToJSON tests the convertYAMLToJSON function
758func TestConvertYAMLToJSON(t *testing.T) {

Callers

nothing calls this directly

Calls 2

ExtractImageDigestFunction · 0.92
RunMethod · 0.65

Tested by

no test coverage detected