Initial local backup snapshot
This commit is contained in:
commit
acd9e14ba5
367 changed files with 118038 additions and 0 deletions
57
shared/mailProviders.test.ts
Normal file
57
shared/mailProviders.test.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { resolveMailConfig } from "./mailProviders";
|
||||
|
||||
describe("resolveMailConfig", () => {
|
||||
it("uses Gmail defaults when provider is gmail", () => {
|
||||
const config = resolveMailConfig({
|
||||
smtpProvider: "gmail",
|
||||
smtpFrom: "notifications@example.com",
|
||||
smtpUser: "notifications@example.com",
|
||||
smtpPass: "secret",
|
||||
});
|
||||
|
||||
expect(config.provider).toBe("gmail");
|
||||
expect(config.host).toBe("smtp.gmail.com");
|
||||
expect(config.port).toBe(465);
|
||||
expect(config.secure).toBe(true);
|
||||
expect(config.ready).toBe(true);
|
||||
});
|
||||
|
||||
it("uses OVH defaults when provider is ovh", () => {
|
||||
const config = resolveMailConfig({
|
||||
smtpProvider: "ovh",
|
||||
smtpFrom: "notifications@example.com",
|
||||
});
|
||||
|
||||
expect(config.provider).toBe("ovh");
|
||||
expect(config.host).toBe("smtp.mail.ovh.net");
|
||||
expect(config.port).toBe(465);
|
||||
expect(config.secure).toBe(true);
|
||||
expect(config.requireTLS).toBe(false);
|
||||
expect(config.ready).toBe(true);
|
||||
});
|
||||
|
||||
it("supports custom SMTP host and port", () => {
|
||||
const config = resolveMailConfig({
|
||||
smtpHost: "mail.example.org",
|
||||
smtpPort: "2525",
|
||||
smtpFrom: "notifications@example.org",
|
||||
});
|
||||
|
||||
expect(config.provider).toBe("custom");
|
||||
expect(config.host).toBe("mail.example.org");
|
||||
expect(config.port).toBe(2525);
|
||||
expect(config.ready).toBe(true);
|
||||
});
|
||||
|
||||
it("reports missing SMTP_PASS when only SMTP_USER is present", () => {
|
||||
const config = resolveMailConfig({
|
||||
smtpProvider: "outlook",
|
||||
smtpFrom: "notifications@example.com",
|
||||
smtpUser: "notifications@example.com",
|
||||
});
|
||||
|
||||
expect(config.ready).toBe(false);
|
||||
expect(config.missing).toContain("SMTP_PASS");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue