Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { expect, test } from 'bun:test'; |
| 2 | import { readFileSync } from 'node:fs'; |
| 3 | import { frontmatter } from 'fumadocs-core/content/md/frontmatter'; |
| 4 | import { docs } from '../../source.config'; |
| 5 | import { readPageByUrl } from '../../agent/lib/docs'; |
| 6 | import context from '../../agent/instructions/context'; |
| 7 | import { TOOLKIT_COUNT_LABEL, resolveToolkitCount } from '../../lib/toolkit-count'; |
| 8 | import { getMetaToolBySlug } from '../../lib/meta-tools-data'; |
| 9 | import { generateIndexMdx, generateToolMdx } from '../../scripts/generate-meta-tools'; |
| 10 | |
| 11 | test('one catalog count reaches frontmatter, agent content, and meta-tool display copy', async () => { |
| 12 | expect(resolveToolkitCount('%TOOLKIT_COUNT% toolkits, %TOOLKIT_COUNT% apps')) |
| 13 | .toBe(`${TOOLKIT_COUNT_LABEL} toolkits, ${TOOLKIT_COUNT_LABEL} apps`); |
| 14 | for (const [path, noun] of [ |
| 15 | ['content/docs/providers/openai.mdx', 'apps'], |
| 16 | ['content/docs/claude-code-plugin.mdx', 'apps'], |
| 17 | ]) { |
| 18 | const parsed = docs.docs.schema.parse(frontmatter(readFileSync(path, 'utf8')).data); |
| 19 | expect(parsed.description).toContain(`${TOOLKIT_COUNT_LABEL} ${noun}`); |
| 20 | } |
| 21 | expect(readPageByUrl('/docs/quickstart')?.raw).toContain(`${TOOLKIT_COUNT_LABEL} apps`); |
| 22 | expect(readPageByUrl('/reference')?.raw).toContain(`${TOOLKIT_COUNT_LABEL} toolkits`); |
| 23 | expect(readPageByUrl('/docs/providers/custom-providers/typescript')?.raw) |
| 24 | .toContain(`call tools across ${TOOLKIT_COUNT_LABEL} toolkits`); |
| 25 | expect(context.markdown).toContain(`${TOOLKIT_COUNT_LABEL} toolkits`); |
| 26 | expect((await getMetaToolBySlug('COMPOSIO_SEARCH_TOOLS'))?.summary) |
| 27 | .toContain(`${TOOLKIT_COUNT_LABEL} toolkits`); |
| 28 | }); |
| 29 | |
| 30 | test('meta-tool regeneration retains the count placeholder instead of the API count', () => { |
| 31 | const tools = JSON.parse(readFileSync('public/data/meta-tools.json', 'utf8')); |
| 32 | expect(generateIndexMdx(tools)).toBe(readFileSync('content/toolkits/meta-tools/index.mdx', 'utf8')); |
| 33 | const search = tools.find((tool: { slug: string }) => tool.slug === 'COMPOSIO_SEARCH_TOOLS'); |
| 34 | expect(generateToolMdx(search)).toBe(readFileSync('content/toolkits/meta-tools/search_tools.mdx', 'utf8')); |
| 35 | expect(generateToolMdx(search)).toContain('%TOOLKIT_COUNT% toolkits'); |
| 36 | }); |