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

Function TestCreateErrorResult

cmd/validate/vsa_test.go:1982–2003  ·  view source on GitHub ↗

TestCreateErrorResult tests the createErrorResult helper function

(t *testing.T)

Source from the content-addressed store, hash-verified

1980
1981// TestCreateErrorResult tests the createErrorResult helper function
1982func TestCreateErrorResult(t *testing.T) {
1983 component := app.SnapshotComponent{
1984 Name: "test-component",
1985 ContainerImage: "registry.com/image:tag",
1986 }
1987 err := errors.New("test error")
1988
1989 result := createErrorResult(component, err)
1990
1991 assert.Equal(t, component.Name, result.ComponentName)
1992 assert.Equal(t, component.ContainerImage, result.ImageRef)
1993 assert.Equal(t, err, result.Error)
1994
1995 // Result should be populated with ValidationResult created from error
1996 assert.NotNil(t, result.Result)
1997 assert.Equal(t, "test error", result.Result.Message)
1998 assert.False(t, result.Result.Passed)
1999 assert.False(t, result.Result.SignatureVerified)
2000 assert.Equal(t, "retrieval_failed", result.Result.ReasonCode)
2001
2002 assert.Nil(t, result.FallbackResult)
2003}
2004
2005func TestBuildHeaderDisplay(t *testing.T) {
2006 // Test with a specific timestamp

Callers

nothing calls this directly

Calls 1

createErrorResultFunction · 0.85

Tested by

no test coverage detected