Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
test(docs): add static tests for quickstart PromptBanner
- Validate all 6 prompts exist with required sections - Verify deprecated section includes code examples - Guard against markdown headings in prompts (TOC pollution) - Ensure mdxToCleanMarkdown strips PromptBanner from .md output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmitha Mallesh committed
Mar 7, 2026 at 00:17 UTC
0dbecb5f74eb03e2f2da69fc6ded56cf30fb76fe
1 file changed
+115
docs/tests/static/quickstart-prompts.test.ts
new
+115
@@ -0,0 +1,115 @@
1
+/**
2
+ * Quickstart PromptBanner static validation.
3
+ *
4
+ * Validates prompt content quality directly from the MDX source:
5
+ * - All 6 integration variants have prompts
6
+ * - Each prompt has the required sections (concepts, rules, deprecated, verify)
7
+ * - Prompts contain code examples (deprecated patterns)
8
+ * - No markdown headings leak into TOC
9
+ * - PromptBanner is stripped from LLM .md output
10
+ */
11
+import { describe, test, expect } from "bun:test";
12
+import { readFile } from "fs/promises";
13
+import { join } from "path";
14
+import { mdxToCleanMarkdown } from "../../lib/source";
15
+
16
+const QUICKSTART_PATH = join(
17
+ import.meta.dir,
18
+ "../../content/docs/quickstart.mdx"
19
+);
20
+
21
+let rawContent: string;
22
+let blocks: string[];
23
+
24
+describe("Quickstart PromptBanner", () => {
25
+ test("quickstart.mdx has 6 PromptBanner blocks (one per integration variant)", async () => {
26
+ rawContent = await readFile(QUICKSTART_PATH, "utf-8");
27
+ blocks =
28
+ rawContent.match(/<PromptBanner>([\s\S]*?)<\/PromptBanner>/g) ?? [];
29
+ expect(blocks.length).toBe(6);
30
+ });
31
+
32
+ test("each prompt has required sections", () => {
33
+ const required = [
34
+ "**Key concepts**",
35
+ "**Rules**",
36
+ "ALWAYS:",
37
+ "NEVER:",
38
+ "**Deprecated",
39
+ "**Verify before responding**",
40
+ ];
41
+ const errors: string[] = [];
42
+
43
+ for (let i = 0; i < blocks.length; i++) {
44
+ for (const section of required) {
45
+ if (!blocks[i].includes(section)) {
46
+ errors.push(`Prompt #${i + 1}: missing "${section}"`);
47
+ }
48
+ }
49
+ }
50
+
51
+ expect(errors).toEqual([]);
52
+ });
53
+
54
+ test("each prompt has code in deprecated section", () => {
55
+ const errors: string[] = [];
56
+
57
+ for (let i = 0; i < blocks.length; i++) {
58
+ const afterDeprecated = blocks[i].split("**Deprecated")[1] ?? "";
59
+ const hasCodeFence = afterDeprecated.includes("```");
60
+ if (!hasCodeFence) {
61
+ errors.push(`Prompt #${i + 1}: deprecated section has no code examples`);
62
+ }
63
+ }
64
+
65
+ expect(errors).toEqual([]);
66
+ });
67
+
68
+ test("each prompt mentions session-based pattern", () => {
69
+ const errors: string[] = [];
70
+
71
+ for (let i = 0; i < blocks.length; i++) {
72
+ if (!blocks[i].includes("session") && !blocks[i].includes("Session")) {
73
+ errors.push(`Prompt #${i + 1}: doesn't mention sessions`);
74
+ }
75
+ }
76
+
77
+ expect(errors).toEqual([]);
78
+ });
79
+
80
+ test("each prompt warns against deprecated composio.tools.get()", () => {
81
+ const errors: string[] = [];
82
+
83
+ for (let i = 0; i < blocks.length; i++) {
84
+ if (!blocks[i].includes("composio.tools.get()")) {
85
+ errors.push(`Prompt #${i + 1}: missing composio.tools.get() deprecation warning`);
86
+ }
87
+ }
88
+
89
+ expect(errors).toEqual([]);
90
+ });
91
+
92
+ test("no markdown headings inside prompts (would pollute TOC)", () => {
93
+ const errors: string[] = [];
94
+
95
+ for (let i = 0; i < blocks.length; i++) {
96
+ const withoutCode = blocks[i].replace(/```[\s\S]*?```/g, "");
97
+ const heading = withoutCode.match(/^#{1,6}\s+/m);
98
+ if (heading) {
99
+ errors.push(
100
+ `Prompt #${i + 1}: contains heading "${heading[0].trim()}" — use **bold** instead`
101
+ );
102
+ }
103
+ }
104
+
105
+ expect(errors).toEqual([]);
106
+ });
107
+
108
+ test("mdxToCleanMarkdown strips all PromptBanner blocks from .md output", () => {
109
+ const cleaned = mdxToCleanMarkdown(rawContent);
110
+ expect(cleaned).not.toContain("<PromptBanner>");
111
+ expect(cleaned).not.toContain("</PromptBanner>");
112
+ expect(cleaned).not.toContain("ALWAYS:");
113
+ expect(cleaned).not.toContain("Deprecated (DO NOT use)");
114
+ });
115
+});