(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func 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 | } |
nothing calls this directly
no test coverage detected