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

Function TestGenMdxTreeSupportsCodeOnlyExamples

internal/docs/mdx_test.go:76–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestGenMdxTreeSupportsCodeOnlyExamples(t *testing.T) {
77 root := &cobra.Command{
78 Use: "algolia",
79 Short: "Algolia CLI",
80 Example: `
81$ algolia search MOVIES --query "toy story"
82$ algolia objects browse MOVIES
83`,
84 }
85
86 dir := t.TempDir()
87 require.NoError(t, GenMdxTree(root, dir))
88
89 rootContent := readTestFile(t, filepath.Join(dir, "index.mdx"))
90 require.Contains(t, rootContent, "## Examples")
91 require.Contains(t, rootContent, "algolia search MOVIES --query \"toy story\"")
92 require.Contains(t, rootContent, "algolia objects browse MOVIES")
93}
94
95func TestExamplesListParsesMixedExampleFormats(t *testing.T) {
96 cmd := Command{

Callers

nothing calls this directly

Calls 2

GenMdxTreeFunction · 0.85
readTestFileFunction · 0.70

Tested by

no test coverage detected