MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestExtractNameAndDigestFromRef

Function TestExtractNameAndDigestFromRef

pkg/policies/loader_test.go:105–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestExtractNameAndDigestFromRef(t *testing.T) {
106 testCases := []struct {
107 ref string
108 want []string
109 }{
110 {
111 ref: "chainloop://policy.json@sha256:1234",
112 want: []string{"chainloop://policy.json", "sha256:1234"},
113 },
114 {
115 ref: "chainloop://policy.json",
116 want: []string{"chainloop://policy.json", ""},
117 },
118 {
119 ref: "",
120 want: []string{"", ""},
121 },
122 }
123
124 for _, tc := range testCases {
125 gotName, gotDigest := ExtractDigest(tc.ref)
126 assert.Equal(t, tc.want[0], gotName)
127 assert.Equal(t, tc.want[1], gotDigest)
128 }
129}

Callers

nothing calls this directly

Calls 1

ExtractDigestFunction · 0.85

Tested by

no test coverage detected