/** * Local test script for the condition check reminder lambda * * Usage: * 1. Set environment variables (or create a .env file) * 2. Run: node test-local.js * * Required environment variables: * - DATABASE_URL: PostgreSQL connection string * - FRONTEND_URL: Frontend URL for email links * - SES_FROM_EMAIL: Email sender address * - EMAIL_ENABLED: Set to 'false' to skip actual email sending * - SCHEDULE_GROUP_NAME: EventBridge schedule group name * - AWS_REGION: AWS region */ const { handler } = require('./index'); // Test event - modify these values as needed const testEvent = { rentalId: parseInt(process.argv[2]) || 1, // Pass rental ID as CLI arg or default to 1 checkType: process.argv[3] || 'pre_rental_owner' // Options: pre_rental_owner, rental_start_renter, rental_end_renter, post_rental_owner }; console.log('Running condition check reminder lambda locally...'); console.log('Event:', JSON.stringify(testEvent, null, 2)); console.log('---'); handler(testEvent) .then(result => { console.log('---'); console.log('Success!'); console.log('Result:', JSON.stringify(result, null, 2)); process.exit(0); }) .catch(err => { console.error('---'); console.error('Error:', err.message); console.error(err.stack); process.exit(1); });