(t *testing.T)
| 229 | } |
| 230 | |
| 231 | func TestIsImageReference(t *testing.T) { |
| 232 | tests := []struct { |
| 233 | name string |
| 234 | identifier string |
| 235 | expected bool |
| 236 | }{ |
| 237 | { |
| 238 | name: "docker hub reference", |
| 239 | identifier: "nginx:latest", |
| 240 | expected: true, |
| 241 | }, |
| 242 | { |
| 243 | name: "registry reference", |
| 244 | identifier: "registry.io/repo:tag", |
| 245 | expected: true, |
| 246 | }, |
| 247 | { |
| 248 | name: "reference with digest", |
| 249 | identifier: "registry.io/repo:sha256-abc123", |
| 250 | expected: true, |
| 251 | }, |
| 252 | { |
| 253 | name: "quay reference", |
| 254 | identifier: "quay.io/redhat/ubi8:latest", |
| 255 | expected: true, |
| 256 | }, |
| 257 | { |
| 258 | name: "image digest only", |
| 259 | identifier: "sha256:abc123", |
| 260 | expected: false, |
| 261 | }, |
| 262 | { |
| 263 | name: "file path", |
| 264 | identifier: "/path/to/file.json", |
| 265 | expected: false, |
| 266 | }, |
| 267 | { |
| 268 | name: "invalid reference", |
| 269 | identifier: "invalid:", |
| 270 | expected: false, |
| 271 | }, |
| 272 | } |
| 273 | |
| 274 | for _, tt := range tests { |
| 275 | t.Run(tt.name, func(t *testing.T) { |
| 276 | result := vsa.IsImageReference(tt.identifier) |
| 277 | assert.Equal(t, tt.expected, result) |
| 278 | }) |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | func TestIsValidVSAIdentifier(t *testing.T) { |
| 283 | tests := []struct { |
nothing calls this directly
no test coverage detected