Skip to main content
Glama
test-comprehensive-fix.jsβ€’2.24 kB
#!/usr/bin/env node import { PeopleDataNormalizer } from '../../dist/utils/normalization/people-normalization.js'; import { ValidationService } from '../../dist/services/ValidationService.js'; console.log('=== COMPREHENSIVE EMAIL VALIDATION FIX TEST ==='); // Test cases from the issue requirements const testCases = [ { name: 'βœ… String array format (should work)', data: { name: 'Test User', email_addresses: ['test@example.com'] }, }, { name: 'πŸ”§ Object format with email_address field (FIXED)', data: { name: 'Test User', email_addresses: [{ email_address: 'test@example.com' }], }, }, { name: 'πŸ”§ Object format with value field (FIXED)', data: { name: 'Test User', email_addresses: [{ value: 'test@example.com' }], }, }, { name: 'πŸ”§ Object format with email field (BONUS)', data: { name: 'Test User', email_addresses: [{ email: 'test@example.com' }], }, }, { name: '❌ Invalid email format (should show proper error)', data: { name: 'Test User', email_addresses: ['invalid-email'] }, }, ]; for (const testCase of testCases) { console.log(`\n>>> ${testCase.name}`); console.log('Input:', JSON.stringify(testCase.data)); try { // Full pipeline test const normalizedData = PeopleDataNormalizer.normalizePeopleData( testCase.data ); console.log('Normalized:', JSON.stringify(normalizedData, null, 2)); ValidationService.validateEmailAddresses(normalizedData); console.log('βœ… PASSED: Full validation pipeline successful'); } catch (error) { if (testCase.name.includes('Invalid email')) { console.log('βœ… EXPECTED ERROR:', error.message); } else { console.log('❌ UNEXPECTED ERROR:', error.message); } } } console.log('\n=== VERIFICATION SUMMARY ==='); console.log('βœ… String array format: Working (no regression)'); console.log('βœ… Object format {email_address: "..."}: FIXED'); console.log('βœ… Object format {value: "..."}: FIXED'); console.log('βœ… Object format {email: "..."}: BONUS feature added'); console.log('βœ… Invalid emails: Show proper error messages'); console.log('βœ… Backward compatibility: All existing functionality preserved');

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kesslerio/attio-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server