(t *testing.T)
| 74 | } |
| 75 | |
| 76 | func 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 | |
| 95 | func TestExamplesListParsesMixedExampleFormats(t *testing.T) { |
| 96 | cmd := Command{ |
nothing calls this directly
no test coverage detected