* Test invalid path handling
()
| 409 | * Test invalid path handling |
| 410 | */ |
| 411 | async function testInvalidPath() { |
| 412 | console.log(`${colors.yellow}Testing invalid path handling...${colors.reset}`); |
| 413 | |
| 414 | try { |
| 415 | const result = await handleStartSearch({ |
| 416 | path: '/nonexistent/path/that/does/not/exist', |
| 417 | pattern: 'pattern', |
| 418 | searchType: 'content' |
| 419 | }); |
| 420 | |
| 421 | // Should handle gracefully |
| 422 | assert(result.content, 'Result should have content'); |
| 423 | const text = result.content[0].text; |
| 424 | const isValidResponse = text.includes('Error') || text.includes('session:') || text.includes('not allowed'); |
| 425 | assert(isValidResponse, 'Should handle invalid path gracefully'); |
| 426 | |
| 427 | console.log(`${colors.green}✓ Invalid path test passed${colors.reset}`); |
| 428 | } catch (error) { |
| 429 | // It's also acceptable for the function to throw an error for invalid paths |
| 430 | console.log(`${colors.green}✓ Invalid path test passed (threw error as expected)${colors.reset}`); |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Test schema validation with invalid arguments |
no test coverage detected