P0-R3-TEST-PLAN.md
This document outlines comprehensive test coverage for the P0-R3 feature (Template-based Configuration Examples). The feature adds real-world configuration examples from popular templates to node search and essentials tools.
Feature Overview:
template_node_configs (197 pre-extracted configurations)search_nodes({includeExamples: true}) and get_node_essentials({includeExamples: true})get_node_for_task tool/tests/unit/scripts/fetch-templates-extraction.test.ts ✅Purpose: Test template extraction logic from fetch-templates.ts
Coverage:
extractNodeConfigs() - 90%+ coverage
detectExpressions() - 100% coverage
={{...}} syntax detection$json references$node referencesTest Count: 27 tests Expected Coverage: 92%+
/tests/unit/mcp/search-nodes-examples.test.ts ✅Purpose: Test search_nodes tool with includeExamples parameter
Coverage:
Test Count: 12 tests Expected Coverage: 85%+
/tests/unit/mcp/get-node-essentials-examples.test.ts ✅Purpose: Test get_node_essentials tool with includeExamples parameter
Coverage:
Test Count: 13 tests Expected Coverage: 88%+
/tests/integration/database/template-node-configs.test.ts ✅Purpose: Test database schema, migrations, and operations
Coverage:
Test Count: 19 tests Expected Coverage: 95%+
/tests/integration/mcp/template-examples-e2e.test.ts ✅Purpose: End-to-end integration testing
Coverage:
Test Count: 14 tests Expected Coverage: 90%+
/tests/fixtures/template-configs.ts ✅Purpose: Reusable test data
Provides:
sampleConfigs: 7 realistic node configurations
sampleWorkflows: 3 complete workflows
Helper Functions:
compressWorkflow() - Compress to base64createTemplateMetadata() - Generate metadatacreateConfigBatch() - Batch create configsgetConfigByComplexity() - Filter by complexitygetConfigsWithExpressions() - Filter with expressionsgetConfigsWithCredentials() - Filter with credentialscreateInsertStatement() - SQL insert helpertests/unit/mcp/parameter-validation.test.tsLine 480: Remove get_node_for_task from legacyValidationTools array
// REMOVE THIS:
{ name: 'get_node_for_task', args: {}, expected: 'Missing required parameters for get_node_for_task: task' },
Status: ⚠️ BREAKING CHANGE - Tool removed
tests/unit/mcp/tools.test.tsUpdate: Remove get_node_for_task from templates category
// BEFORE:
templates: ['list_tasks', 'get_node_for_task', 'search_templates', ...]
// AFTER:
templates: ['list_tasks', 'search_templates', ...]
Add: Tests for new includeExamples parameter in tool definitions
it('should have includeExamples parameter in search_nodes', () => {
const searchNodesTool = tools.find(t => t.name === 'search_nodes');
expect(searchNodesTool.inputSchema.properties.includeExamples).toBeDefined();
expect(searchNodesTool.inputSchema.properties.includeExamples.type).toBe('boolean');
expect(searchNodesTool.inputSchema.properties.includeExamples.default).toBe(false);
});
it('should have includeExamples parameter in get_node_essentials', () => {
const essentialsTool = tools.find(t => t.name === 'get_node_essentials');
expect(essentialsTool.inputSchema.properties.includeExamples).toBeDefined();
});
Status: ⚠️ REQUIRED UPDATE
tests/integration/mcp-protocol/session-management.test.tsRemove: Test case calling get_node_for_task with invalid task
// REMOVE THIS TEST:
client.callTool({ name: 'get_node_for_task', arguments: { task: 'invalid_task' } }).catch(e => e)
Status: ⚠️ BREAKING CHANGE
tests/integration/mcp-protocol/tool-invocation.test.tsRemove: Entire get_node_for_task describe block
Add: Tests for new includeExamples functionality
describe('search_nodes with includeExamples', () => {
it('should return examples when includeExamples is true', async () => {
const response = await client.callTool({
name: 'search_nodes',
arguments: { query: 'webhook', includeExamples: true }
});
expect(response.results).toBeDefined();
// Examples may or may not be present depending on database
});
it('should not return examples when includeExamples is false', async () => {
const response = await client.callTool({
name: 'search_nodes',
arguments: { query: 'webhook', includeExamples: false }
});
expect(response.results).toBeDefined();
response.results.forEach(node => {
expect(node.examples).toBeUndefined();
});
});
});
describe('get_node_essentials with includeExamples', () => {
it('should return examples with metadata when includeExamples is true', async () => {
const response = await client.callTool({
name: 'get_node_essentials',
arguments: { nodeType: 'nodes-base.webhook', includeExamples: true }
});
expect(response.nodeType).toBeDefined();
// Examples may or may not be present depending on database
});
});
Status: ⚠️ REQUIRED UPDATE
tests/unit/services/task-templates.test.tsStatus: ✅ No changes needed (TaskTemplates marked as deprecated but not removed)
Note: TaskTemplates remains for backward compatibility. Tests should continue to pass.
# Run new unit tests
npm test tests/unit/scripts/fetch-templates-extraction.test.ts
npm test tests/unit/mcp/search-nodes-examples.test.ts
npm test tests/unit/mcp/get-node-essentials-examples.test.ts
# Expected: All pass, 52 tests
# Run new integration tests
npm test tests/integration/database/template-node-configs.test.ts
npm test tests/integration/mcp/template-examples-e2e.test.ts
# Expected: All pass, 33 tests
# Update files as outlined above, then run:
npm test tests/unit/mcp/parameter-validation.test.ts
npm test tests/unit/mcp/tools.test.ts
npm test tests/integration/mcp-protocol/session-management.test.ts
npm test tests/integration/mcp-protocol/tool-invocation.test.ts
# Expected: All pass after updates
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Expected coverage improvements:
# - src/scripts/fetch-templates.ts: +20% (60% → 80%)
# - src/mcp/server.ts: +5% (75% → 80%)
# - Overall project: +2% (current → current+2%)
| File | Function | Target | Tests |
|---|---|---|---|
| fetch-templates.ts | extractNodeConfigs | 95% | 15 tests |
| fetch-templates.ts | detectExpressions | 100% | 12 tests |
| server.ts | searchNodes (with examples) | 90% | 8 tests |
| server.ts | getNodeEssentials (with examples) | 90% | 10 tests |
| Database migration | template_node_configs | 100% | 19 tests |
All dependencies already present in package.json:
Backward Compatibility
Performance
Data Integrity
No changes required. Existing test commands will run new tests:
- run: npm test
- run: npm run test:coverage
Current thresholds maintained. Expected improvements:
npm run rebuild - Verify migration applies cleanlynpm run fetch:templates --extract-only - Verify extraction worksSELECT COUNT(*) FROM template_node_configs - Should be ~197search_nodes({query: "webhook", includeExamples: true})get_node_essentials({nodeType: "nodes-base.webhook", includeExamples: true})If issues are detected:
Database Rollback:
DROP TABLE IF EXISTS template_node_configs;
DROP VIEW IF EXISTS ranked_node_configs;
Code Rollback:
Test Rollback:
This test plan provides comprehensive coverage for the P0-R3 feature with:
All test files are ready for execution. Update the 4 existing test files as outlined, then run the full test suite.
Estimated Total Implementation Time: 2-3 hours for updating existing tests + validation