From af949b09a5e0ec5cebe0b09b1291636815c72212 Mon Sep 17 00:00:00 2001 From: czlonkowski <56956555+czlonkowski@users.noreply.github.com> Date: Mon, 6 Oct 2025 08:21:17 +0200 Subject: [PATCH] test: update parameter validation test for Issue #275 fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test expected empty strings to pass validation, but our Issue #275 fix intentionally rejects empty strings to prevent TypeErrors. Change: - Updated test from "should pass" to "should reject" - Now expects error: "String parameters cannot be empty" - Aligns with Issue #275 fix that eliminated 57.4% of production errors The old behavior (allowing empty strings) caused TypeErrors in getNodeTypeAlternatives(). The new behavior (rejecting empty strings) provides clear error messages and prevents crashes. Related: Issue #275 - TypeError prevention 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/unit/mcp/parameter-validation.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/mcp/parameter-validation.test.ts b/tests/unit/mcp/parameter-validation.test.ts index 7bfa0bc..d17e3c3 100644 --- a/tests/unit/mcp/parameter-validation.test.ts +++ b/tests/unit/mcp/parameter-validation.test.ts @@ -74,12 +74,12 @@ describe('Parameter Validation', () => { }).toThrow('Missing required parameters for test_tool: nodeType'); }); - it('should pass when required parameter is empty string', () => { + it('should reject when required parameter is empty string (Issue #275 fix)', () => { const args = { query: '', limit: 10 }; - + expect(() => { server.testValidateToolParams('test_tool', args, ['query']); - }).not.toThrow(); + }).toThrow('String parameters cannot be empty'); }); it('should pass when required parameter is zero', () => {