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

Function Test_runTestCmd_dryRunJSON

pkg/cmd/crawler/test/test_test.go:62–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func 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}

Callers

nothing calls this directly

Calls 4

NewFactoryFunction · 0.92
ExecuteFunction · 0.92
NewTestCmdFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected