(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func Test_runCreateCmd_dryRunJSON(t *testing.T) { |
| 127 | tmpFile := filepath.Join(t.TempDir(), "config.json") |
| 128 | err := os.WriteFile(tmpFile, []byte("{\"appId\":\"test-app\"}"), 0o600) |
| 129 | require.NoError(t, err) |
| 130 | |
| 131 | r := httpmock.Registry{} |
| 132 | f, out := test.NewFactory(false, &r, nil, "") |
| 133 | cmd := NewCreateCmd(f, nil) |
| 134 | |
| 135 | out, err = test.Execute(cmd, fmt.Sprintf("my-crawler -F '%s' --dry-run --output json", tmpFile), out) |
| 136 | if err != nil { |
| 137 | t.Fatal(err) |
| 138 | } |
| 139 | |
| 140 | assert.Contains(t, out.String(), `"action":"create_crawler"`) |
| 141 | assert.Contains(t, out.String(), `"name":"my-crawler"`) |
| 142 | assert.Contains(t, out.String(), `"config":{"appId":"test-app"}`) |
| 143 | assert.Contains(t, out.String(), `"dryRun":true`) |
| 144 | } |
nothing calls this directly
no test coverage detected