(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func Test_runTestCmd_dryRunJSON(t *testing.T) { |
| 63 | tmpFile := filepath.Join(t.TempDir(), "config.json") |
| 64 | err := os.WriteFile(tmpFile, []byte(`{"appId":"test-app"}`), 0o600) |
| 65 | require.NoError(t, err) |
| 66 | |
| 67 | f, out := test.NewFactory(false, nil, nil, "") |
| 68 | cmd := NewTestCmd(f, nil) |
| 69 | |
| 70 | out, err = test.Execute(cmd, fmt.Sprintf("my-crawler --url https://example.com -F '%s' --dry-run --output json", tmpFile), out) |
| 71 | require.NoError(t, err) |
| 72 | |
| 73 | assert.Contains(t, out.String(), `"action":"test_crawler"`) |
| 74 | assert.Contains(t, out.String(), `"id":"my-crawler"`) |
| 75 | assert.Contains(t, out.String(), `"url":"https://example.com"`) |
| 76 | assert.Contains(t, out.String(), `"config":{"appId":"test-app"}`) |
| 77 | assert.Contains(t, out.String(), `"dryRun":true`) |
| 78 | } |
nothing calls this directly
no test coverage detected