TestExtractImageDigest tests the extractImageDigest function
(t *testing.T)
| 719 | |
| 720 | // TestExtractImageDigest tests the extractImageDigest function |
| 721 | func 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 |
| 758 | func TestConvertYAMLToJSON(t *testing.T) { |
nothing calls this directly
no test coverage detected