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

Function TestSetAttestationSyntaxCheckFromError

internal/output/output_test.go:1004–1043  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1002}
1003
1004func TestSetAttestationSyntaxCheckFromError(t *testing.T) {
1005 cases := []struct {
1006 name string
1007 err error
1008 expectedPassed bool
1009 expectedResult *evaluator.Result
1010 }{
1011 {
1012 name: "success",
1013 expectedPassed: true,
1014 expectedResult: &evaluator.Result{
1015 Message: "Pass",
1016 Metadata: map[string]interface{}{
1017 "code": "builtin.attestation.syntax_check",
1018 },
1019 },
1020 },
1021 {
1022 name: "failure",
1023 expectedPassed: false,
1024 err: errors.New("kaboom!"),
1025 expectedResult: &evaluator.Result{
1026 Message: "Attestation syntax check failed: kaboom!",
1027 Metadata: map[string]interface{}{
1028 "code": "builtin.attestation.syntax_check",
1029 },
1030 },
1031 },
1032 }
1033
1034 for _, c := range cases {
1035 t.Run(c.name, func(t *testing.T) {
1036 o := Output{}
1037 o.SetAttestationSyntaxCheckFromError(c.err)
1038
1039 assert.Equal(t, c.expectedPassed, o.AttestationSyntaxCheck.Passed)
1040 assert.Equal(t, c.expectedResult, o.AttestationSyntaxCheck.Result)
1041 })
1042 }
1043}
1044
1045func TestKeepSomeMetadataSingle(t *testing.T) {
1046 cases := []struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65

Tested by

no test coverage detected