@devries-cameron20 / composio-1 / commits / 763fd36b1
Fork 0

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): isolate Instant rendering from shared Next mocks

Brendan O'Leary committed Oct 8, 2026 at 01:19 UTC 763fd36b1e339e29c42f61949a9a7eab1ffc4eae
1 file changed +21 -14
docs/tests/static/instant-catalog.test.ts
+21 -14
@@ -3,23 +3,30 @@ import { instantDiscount, instantPricingDescription, instantSchema, toolkitSuppo
3 import { readFileSync } from 'node:fs';
4 import { toolFromApi } from '../../lib/toolkit-schema';
5 import { parseNamedItems, transformToolkit } from '../../scripts/generate-toolkits';
6 -import { createElement } from 'react';
7 -import { renderToStaticMarkup } from 'react-dom/server';
8 -import { ToolkitDetail } from '../../components/toolkits/toolkit-detail';
9 -import type { Toolkit } from '../../types/toolkit';
6 +import { spawnSync } from 'node:child_process';
7 +import { join } from 'node:path';
8
9 describe('Instant catalog metadata', () => {
10 test('toolkit headers show live tool eligibility when the snapshot lacks Instant metadata', () => {
13 - const toolkit: Toolkit = {
14 - slug: 'example', name: 'Example', logo: null, category: null,
15 - description: 'Example toolkit', authSchemes: [], toolCount: 1,
16 - triggerCount: 0, version: null, tools: [], triggers: [],
17 - };
18 - const html = renderToStaticMarkup(createElement(ToolkitDetail, {
19 - toolkit,
20 - tools: [toolFromApi({ slug: 'EXAMPLE_SEARCH', instant: { supported: true } })],
21 - triggers: [], path: '/toolkits/example',
22 - }));
11 + // Other suites mock next/navigation; render with real Next exports in a fresh process.
12 + const rendered = spawnSync(process.execPath, ['--eval', `
13 + import { createElement } from 'react';
14 + import { renderToStaticMarkup } from 'react-dom/server';
15 + import { ToolkitDetail } from './components/toolkits/toolkit-detail';
16 + import { toolFromApi } from './lib/toolkit-schema';
17 + const toolkit = {
18 + slug: 'example', name: 'Example', logo: null, category: null,
19 + description: 'Example toolkit', authSchemes: [], toolCount: 1,
20 + triggerCount: 0, version: null, tools: [], triggers: [],
21 + };
22 + console.log(renderToStaticMarkup(createElement(ToolkitDetail, {
23 + toolkit,
24 + tools: [toolFromApi({ slug: 'EXAMPLE_SEARCH', instant: { supported: true } })],
25 + triggers: [], path: '/toolkits/example',
26 + })));
27 + `], { cwd: join(import.meta.dir, '../..'), encoding: 'utf8', timeout: 10000 });
28 + expect(rendered.status, rendered.stderr).toBe(0);
29 + const html = rendered.stdout;
30 expect(html).toContain('is available on the latest version. Check each tool for support and pricing.');
31 expect(html.match(/title="Instant is supported on the latest version"/g)).toHaveLength(2);
32 });