MCPcopy Create free account
hub / github.com/algolia/cli / Test_runCreateCmd_dryRunJSON

Function Test_runCreateCmd_dryRunJSON

pkg/cmd/crawler/create/create_test.go:126–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func 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}

Callers

nothing calls this directly

Calls 4

NewFactoryFunction · 0.92
ExecuteFunction · 0.92
NewCreateCmdFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected