All files / src/platform/notifications/providers mock-email.provider.ts

0% Statements 0/9
100% Branches 0/0
0% Functions 0/2
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                                     
import { Logger } from '@nestjs/common';
import { NotificationChannelProvider } from '../notification-provider.interface';
 
export class MockEmailProvider implements NotificationChannelProvider {
  readonly channel = 'EMAIL';
  readonly name = 'MockSMTP';
  private readonly logger = new Logger(MockEmailProvider.name);
 
  async send(to: string, subject: string, body: string, metadata?: any) {
    this.logger.log(`[EMAIL DISPATCH] To: ${to} | Subject: ${subject}`);
    // Simulate SMTP network call
    await new Promise((resolve) => setTimeout(resolve, 100));
    return {
      success: true,
      messageId: `email-${Math.random().toString(36).substr(2, 9)}`,
    };
  }
}