(t *testing.T)
| 280 | } |
| 281 | |
| 282 | func Test_ValidateInputCmd_PolicyParsingError(t *testing.T) { |
| 283 | fs := afero.NewMemMapFs() |
| 284 | require.NoError(t, afero.WriteFile(fs, "/file.yaml", []byte("some: data"), 0o644)) |
| 285 | |
| 286 | cmd, _ := setUpValidateInputCmd(nil, fs) |
| 287 | cmd.SetArgs([]string{ |
| 288 | "input", |
| 289 | "--file", "/file.yaml", |
| 290 | "--policy", `{"invalidjson":"}`, |
| 291 | }) |
| 292 | |
| 293 | err := cmd.Execute() |
| 294 | assert.Error(t, err) |
| 295 | // Adjust the assertion if a different error message is thrown by your policy parser |
| 296 | assert.Contains(t, err.Error(), "unable to parse EnterpriseContractPolicySpec") |
| 297 | } |
| 298 | |
| 299 | func Test_ValidateInputCmd_EmptyPolicyFile(t *testing.T) { |
| 300 | fs := afero.NewMemMapFs() |
nothing calls this directly
no test coverage detected