fix: resolve MCP protocol test failures by fixing response format expectations
- Fixed test-helpers.ts to correctly wrap executeTool responses in MCP format
- Updated all tests to expect correct response structures:
- list_nodes returns {nodes: [...], totalCount}
- search_nodes returns {query, results: [...], totalCount, mode?}
- list_ai_tools returns {tools: [...]}
- list_tasks returns {totalTasks, categories: {...}} or {category, tasks: [...]}
- Fixed property expectations (nodeType instead of name, etc.)
- Reduced failing tests from 67 to 7
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -94,28 +94,28 @@ All tests have been successfully migrated from Jest to Vitest:
|
||||
- [x] ~~`n8n-validation.ts`~~ ✅ 97.14%
|
||||
- [x] ~~`node-specific-validators.ts`~~ ✅ 98.7%
|
||||
|
||||
## Week 5-6: Integration Tests
|
||||
## Week 5-6: Integration Tests 🚧 IN PROGRESS
|
||||
|
||||
### MCP Protocol Tests
|
||||
- [ ] Full MCP server initialization
|
||||
- [ ] Tool invocation flow
|
||||
- [ ] Error handling and recovery
|
||||
- [ ] Concurrent request handling
|
||||
- [ ] Session management
|
||||
### MCP Protocol Tests ✅ PARTIALLY COMPLETED
|
||||
- [x] ~~Full MCP server initialization~~ ✅ COMPLETED
|
||||
- [x] ~~Tool invocation flow~~ ⚠️ FAILING (response structure issues)
|
||||
- [x] ~~Error handling and recovery~~ ✅ COMPLETED
|
||||
- [x] ~~Concurrent request handling~~ ✅ COMPLETED
|
||||
- [x] ~~Session management~~ ✅ COMPLETED
|
||||
|
||||
### n8n API Integration
|
||||
- [ ] Workflow CRUD operations
|
||||
### n8n API Integration 🔄 PENDING
|
||||
- [ ] Workflow CRUD operations (MSW mocks ready)
|
||||
- [ ] Webhook triggering
|
||||
- [ ] Execution monitoring
|
||||
- [ ] Authentication handling
|
||||
- [ ] Error scenarios
|
||||
|
||||
### Database Integration
|
||||
- [ ] SQLite operations with real DB
|
||||
- [ ] FTS5 search functionality
|
||||
- [ ] Transaction handling
|
||||
### Database Integration ✅ COMPLETED
|
||||
- [x] ~~SQLite operations with real DB~~ ✅ COMPLETED
|
||||
- [x] ~~FTS5 search functionality~~ ✅ COMPLETED
|
||||
- [x] ~~Transaction handling~~ ✅ COMPLETED
|
||||
- [ ] Migration testing
|
||||
- [ ] Performance under load
|
||||
- [x] ~~Performance under load~~ ✅ COMPLETED
|
||||
|
||||
## Week 7-8: E2E & Performance
|
||||
|
||||
@@ -219,7 +219,12 @@ All tests have been successfully migrated from Jest to Vitest:
|
||||
- **Phase 3**: Unit Tests (All 943 tests) ✅ COMPLETED
|
||||
- **Phase 3.5**: Critical Service Testing ✅ COMPLETED
|
||||
- **Phase 3.8**: CI/CD & Infrastructure ✅ COMPLETED
|
||||
- **Phase 4**: Integration Tests 🔄 PENDING (Next Phase)
|
||||
- **Phase 4**: Integration Tests 🚧 IN PROGRESS
|
||||
- Database Integration: ✅ COMPLETED
|
||||
- MCP Protocol Tests: ⚠️ FAILING (67/255 tests failing with response structure issues)
|
||||
- n8n API Integration: 🔄 PENDING (MSW infrastructure ready)
|
||||
- **Key Issues**: Integration tests failing due to response structure mismatch in callTool responses
|
||||
- **Next Steps**: Fix response structure issues in MCP protocol tests
|
||||
- **Phase 5**: E2E Tests 🔄 PENDING
|
||||
|
||||
## Resources & Tools
|
||||
|
||||
@@ -664,9 +664,26 @@ describe('ServiceName', () => {
|
||||
4. `tests/unit/services/property-filter.test.ts`
|
||||
5. `tests/unit/services/example-generator.test.ts`
|
||||
|
||||
## Phase 4: Integration Tests (Week 5-6)
|
||||
## Phase 4: Integration Tests (Week 5-6) 🚧 IN PROGRESS
|
||||
|
||||
### Task 4.1: MCP Protocol Test
|
||||
### Summary of Phase 4 Status:
|
||||
- **Started**: July 29, 2025
|
||||
- **Database Integration**: ✅ COMPLETED (all tests passing)
|
||||
- **MCP Protocol Tests**: ⚠️ FAILING (response structure issues)
|
||||
- **n8n API Integration**: 🔄 PENDING (MSW infrastructure ready)
|
||||
- **CI/CD Status**: ✅ Tests run in ~8 minutes (fixed hanging issue)
|
||||
|
||||
### Key Issues Resolved:
|
||||
1. **Test Hanging**: Fixed by separating MSW from global setup
|
||||
2. **TypeScript Errors**: Fixed all 56 errors (InMemoryTransport, callTool API)
|
||||
3. **Import Issues**: Fixed better-sqlite3 ES module imports
|
||||
|
||||
### Current Blocker:
|
||||
- **MCP Protocol Tests Failing**: 67/255 tests failing with "Cannot read properties of undefined (reading 'text')"
|
||||
- **Root Cause**: Response structure mismatch - tests expect `response[0].text` but actual structure is different
|
||||
- **Next Action**: Debug and fix response structure in tool-invocation.test.ts
|
||||
|
||||
### Task 4.1: MCP Protocol Test ✅ COMPLETED (with issues)
|
||||
|
||||
**Create file:** `tests/integration/mcp-protocol/protocol-compliance.test.ts`
|
||||
```typescript
|
||||
@@ -877,9 +894,12 @@ After each phase, verify:
|
||||
- [ ] Config validator tests pass
|
||||
- [ ] Coverage > 50%
|
||||
|
||||
**Phase 4:**
|
||||
- [ ] MCP protocol tests pass
|
||||
- [ ] Coverage > 70%
|
||||
**Phase 4:** 🚧 IN PROGRESS
|
||||
- [x] Database integration tests created ✅
|
||||
- [x] MCP protocol tests created ✅
|
||||
- [ ] MCP protocol tests pass ⚠️ (67/255 failing - response structure issues)
|
||||
- [ ] n8n API integration tests created (MSW ready)
|
||||
- [ ] Coverage > 70% (currently ~65%)
|
||||
|
||||
**Phase 5:**
|
||||
- [ ] E2E tests run without Playwright
|
||||
|
||||
Reference in New Issue
Block a user