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

Function TestBuildResultDisplay

cmd/validate/vsa_test.go:2056–2155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2054}
2055
2056func TestBuildResultDisplay(t *testing.T) {
2057 tests := []struct {
2058 name string
2059 data AllSectionsData
2060 expected ResultDisplay
2061 }{
2062 {
2063 name: "passed with no fallback",
2064 data: AllSectionsData{
2065 OverallPassed: true,
2066 FallbackUsed: false,
2067 TotalImages: 2,
2068 ImageStatuses: []ImageStatus{
2069 {Index: 1, Digest: "abc12345", VSAStatus: "PASSED", FallbackStatus: ""},
2070 {Index: 2, Digest: "def67890", VSAStatus: "PASSED", FallbackStatus: ""},
2071 },
2072 },
2073 expected: ResultDisplay{
2074 Overall: "✅ PASSED",
2075 Fallback: "",
2076 ImageCount: 2,
2077 ImageLines: []string{
2078 " [1] …abc12345 VSA=PASSED",
2079 " [2] …def67890 VSA=PASSED",
2080 },
2081 },
2082 },
2083 {
2084 name: "failed with fallback for all",
2085 data: AllSectionsData{
2086 OverallPassed: false,
2087 FallbackUsed: true,
2088 FallbackCount: 2,
2089 TotalImages: 2,
2090 ImageStatuses: []ImageStatus{
2091 {Index: 1, Digest: "abc12345", VSAStatus: "FAILED(reason=no_vsa)", FallbackStatus: "PASSED"},
2092 {Index: 2, Digest: "def67890", VSAStatus: "FAILED(reason=no_vsa)", FallbackStatus: "PASSED"},
2093 },
2094 },
2095 expected: ResultDisplay{
2096 Overall: "❌ FAILED",
2097 Fallback: "used for all images",
2098 ImageCount: 2,
2099 ImageLines: []string{
2100 " [1] …abc12345 VSA=FAILED(reason=no_vsa) Fallback=PASSED",
2101 " [2] …def67890 VSA=FAILED(reason=no_vsa) Fallback=PASSED",
2102 },
2103 },
2104 },
2105 {
2106 name: "failed with fallback for some",
2107 data: AllSectionsData{
2108 OverallPassed: false,
2109 FallbackUsed: true,
2110 FallbackCount: 1,
2111 TotalImages: 3,
2112 ImageStatuses: []ImageStatus{
2113 {Index: 1, Digest: "abc12345", VSAStatus: "PASSED", FallbackStatus: ""},

Callers

nothing calls this directly

Calls 2

buildResultDisplayFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected