mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 13:33:11 +00:00
test: fix failing test and add comprehensive version extraction test coverage
Address code review feedback from PR #285: 1. Fix Failing Test (CRITICAL) - Updated test from baseDescription.defaultVersion to description.defaultVersion - Added test to verify baseDescription is correctly ignored (legacy bug) 2. Add Missing Test Coverage (HIGH PRIORITY) - Test currentVersion priority over description.defaultVersion - Test currentVersion = 0 edge case (version 0 should be valid) - All 34 tests now passing 3. Enhanced Documentation - Added comprehensive JSDoc for extractVersion() explaining priority chain - Enhanced validation comments explaining why typeVersion must run before langchain skip - Clarified that parameter validation (not typeVersion) is skipped for langchain nodes Test Results: - ✅ 34/34 tests passing - ✅ Version extraction priority chain validated - ✅ Edge cases covered (version 0, missing properties) - ✅ Legacy bug prevention tested 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,24 @@ export class NodeParser {
|
||||
description.name?.toLowerCase().includes('webhook');
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the version from a node class.
|
||||
*
|
||||
* Priority Chain:
|
||||
* 1. Instance currentVersion (VersionedNodeType's computed property)
|
||||
* 2. Instance description.defaultVersion (explicit default)
|
||||
* 3. Instance nodeVersions (fallback to max available version)
|
||||
* 4. Description version array (legacy nodes)
|
||||
* 5. Description version scalar (simple versioning)
|
||||
* 6. Class-level properties (if instantiation fails)
|
||||
* 7. Default to "1"
|
||||
*
|
||||
* Critical Fix (v2.17.4): Removed check for non-existent instance.baseDescription.defaultVersion
|
||||
* which caused AI Agent to incorrectly return version "3" instead of "2.2"
|
||||
*
|
||||
* @param nodeClass - The node class or instance to extract version from
|
||||
* @returns The version as a string
|
||||
*/
|
||||
private extractVersion(nodeClass: any): string {
|
||||
// Check instance properties first
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user