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

Function setUpValidateInputCmd

cmd/validate/input_test.go:50–66  ·  view source on GitHub ↗
(validate InputValidationFunc, fs afero.Fs)

Source from the content-addressed store, hash-verified

48}
49
50func setUpValidateInputCmd(validate InputValidationFunc, fs afero.Fs) (*cobra.Command, *bytes.Buffer) {
51 // Create the parent validate command to get the persistent flags
52 validateCmd := NewValidateCmd()
53 cmd := validateInputCmd(validate)
54 validateCmd.AddCommand(cmd)
55
56 // Create a fake client and context with a memory filesystem.
57 client := fake.FakeClient{}
58 ctx := utils.WithFS(context.Background(), fs)
59 ctx = oci.WithClient(ctx, &client)
60 validateCmd.SetContext(ctx)
61
62 var out bytes.Buffer
63 validateCmd.SetOut(&out)
64
65 return validateCmd, &out
66}
67
68func Test_ValidateInputCmd_SuccessSingleFile(t *testing.T) {
69 fs := afero.NewMemMapFs()

Calls 4

WithFSFunction · 0.92
WithClientFunction · 0.92
NewValidateCmdFunction · 0.85
validateInputCmdFunction · 0.85

Tested by

no test coverage detected