PSA/server/test-mailhog-polling.js
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

54 lines
1.7 KiB
JavaScript

/**
* Simple test to verify MailHog polling is working
*/
import { MailHogPollingService } from './src/services/email/MailHogPollingService';
import { MailHogClient } from './src/test/e2e/utils/mailhog-client';
async function testMailHogPolling() {
console.log('🧪 Testing MailHog polling service...');
// Create MailHog client and clear any existing messages
const mailhogClient = new MailHogClient();
await mailhogClient.clearMessages();
console.log('✅ Cleared existing emails');
// Create polling service
const pollingService = new MailHogPollingService({
pollIntervalMs: 2000, // Poll every 2 seconds
mailhogApiUrl: 'http://localhost:8025/api/v1'
});
console.log('📧 Starting MailHog polling...');
pollingService.startPolling();
// Wait a moment for the initial poll
await new Promise(resolve => setTimeout(resolve, 3000));
// Send a test email
console.log('📧 Sending test email...');
const sentEmail = await mailhogClient.sendEmail({
from: 'test@example.com',
to: 'support@example.com',
subject: 'Test polling email',
body: 'This email should be detected by the polling service'
});
console.log(`✅ Email sent with ID: ${sentEmail.messageId}`);
// Wait for polling to detect it
console.log('⏳ Waiting for polling service to detect and process email...');
await new Promise(resolve => setTimeout(resolve, 10000));
// Check polling service status
const status = pollingService.getStatus();
console.log('📊 Polling service status:', status);
// Stop polling
console.log('🛑 Stopping polling service...');
pollingService.stopPolling();
console.log('✅ Test completed!');
}
testMailHogPolling().catch(console.error);