46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Test Radicale sync configuration
|
|
*/
|
|
|
|
import { getRadicaleConfig, isRadicaleEnabled, generateVCard } from './src/lib/radicale-sync.js';
|
|
|
|
console.log('🧪 Testing Radicale Sync Configuration\n');
|
|
|
|
// Check if enabled
|
|
if (isRadicaleEnabled()) {
|
|
const config = getRadicaleConfig();
|
|
console.log('✅ Radicale sync is ENABLED');
|
|
console.log(` URL: ${config.url}`);
|
|
console.log(` Username: ${config.username}`);
|
|
console.log(` Password: ${config.password ? '***' + config.password.slice(-3) : 'not set'}`);
|
|
} else {
|
|
console.log('❌ Radicale sync is DISABLED');
|
|
console.log(' Set RADICALE_URL, RADICALE_USERNAME, and RADICALE_PASSWORD in .env.local to enable');
|
|
}
|
|
|
|
console.log('\n📝 Testing VCARD Generation\n');
|
|
|
|
// Test VCARD generation
|
|
const testContact = {
|
|
contact_id: 999,
|
|
name: 'Jan Kowalski',
|
|
phone: '["123-456-789", "987-654-321"]',
|
|
email: 'jan.kowalski@example.com',
|
|
company: 'Test Company',
|
|
position: 'Manager',
|
|
contact_type: 'project',
|
|
notes: 'Test contact for VCARD generation',
|
|
is_active: 1,
|
|
created_at: new Date().toISOString()
|
|
};
|
|
|
|
const vcard = generateVCard(testContact);
|
|
console.log('Generated VCARD:');
|
|
console.log('─'.repeat(60));
|
|
console.log(vcard);
|
|
console.log('─'.repeat(60));
|
|
|
|
console.log('\n✅ Test complete!');
|