mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
fix(tests): resolve foreign key constraints and remove get_node_for_task from integration tests
Two critical fixes for integration test failures: **1. Foreign Key Constraint Violations** Root cause: Tests inserted into template_node_configs without corresponding entries in templates table, causing FK constraint failures. Fixes: - template-node-configs.test.ts: Pre-create 1000 test templates in beforeEach() - template-examples-e2e.test.ts: Create templates in seedTemplateConfigs() and adjust test cases to use non-conflicting template IDs **2. Removed Tool References** Root cause: Tests referenced get_node_for_task tool removed in v2.15.0. Fixes: - tool-invocation.test.ts: Removed entire get_node_for_task test suite - session-management.test.ts: Replaced get_node_for_task test with search_nodes Test results: ✅ template-node-configs.test.ts: 20/20 passed ✅ template-examples-e2e.test.ts: 13/13 passed ✅ tool-invocation.test.ts: 28/28 passed ✅ session-management.test.ts: 16 passed, 2 skipped All integration tests now comply with foreign key constraints and use only existing MCP tools as of v2.15.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -459,30 +459,8 @@ describe('MCP Tool Invocation', () => {
|
||||
});
|
||||
|
||||
describe('Task Templates', () => {
|
||||
describe('get_node_for_task', () => {
|
||||
it('should return pre-configured node for task', async () => {
|
||||
const response = await client.callTool({ name: 'get_node_for_task', arguments: {
|
||||
task: 'post_json_request'
|
||||
}});
|
||||
|
||||
const config = JSON.parse(((response as any).content[0]).text);
|
||||
expect(config).toHaveProperty('task');
|
||||
expect(config).toHaveProperty('nodeType');
|
||||
expect(config).toHaveProperty('configuration');
|
||||
expect(config.configuration.method).toBe('POST');
|
||||
});
|
||||
|
||||
it('should handle unknown tasks', async () => {
|
||||
try {
|
||||
await client.callTool({ name: 'get_node_for_task', arguments: {
|
||||
task: 'unknown_task'
|
||||
}});
|
||||
expect.fail('Should have thrown an error');
|
||||
} catch (error: any) {
|
||||
expect(error.message).toContain('Unknown task');
|
||||
}
|
||||
});
|
||||
});
|
||||
// get_node_for_task was removed in v2.15.0
|
||||
// Use search_nodes({ includeExamples: true }) instead for real-world examples
|
||||
|
||||
describe('list_tasks', () => {
|
||||
it('should list all available tasks', async () => {
|
||||
|
||||
Reference in New Issue
Block a user