This commit is contained in:
Mateusz Gruszczyński
2026-04-07 15:30:49 +02:00
parent e4e2758416
commit 790e2d3b08
12 changed files with 483 additions and 54 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { resolveSmtpSecurity } from '../src/services/mail.service.js';
describe('mail.service', () => {
it('uses STARTTLS for port 587 even when secure flag is enabled', () => {
expect(resolveSmtpSecurity({ smtpPort: 587, smtpSecure: true })).toEqual({
port: 587,
secure: false,
requireTLS: true
});
});
it('uses implicit TLS for port 465', () => {
expect(resolveSmtpSecurity({ smtpPort: 465, smtpSecure: false })).toEqual({
port: 465,
secure: true,
requireTLS: false
});
});
});