38 行
981 B
JavaScript
38 行
981 B
JavaScript
const { resolveEmailDeliveryStatus } = require("../../../src/services/email");
|
|
|
|
describe("email delivery status", () => {
|
|
it("reports ready only when SMTP delivery has the required public settings", () => {
|
|
expect(
|
|
resolveEmailDeliveryStatus({
|
|
emailEnabled: true,
|
|
emailFrom: "[email protected]",
|
|
smtpHost: "smtp.hyinda.test",
|
|
smtpPort: 587,
|
|
smtpSecure: false,
|
|
smtpUser: "",
|
|
smtpPass: "",
|
|
}),
|
|
).toEqual({
|
|
ready: true,
|
|
reasons: [],
|
|
});
|
|
});
|
|
|
|
it("reports non-secret missing SMTP reasons", () => {
|
|
expect(
|
|
resolveEmailDeliveryStatus({
|
|
emailEnabled: true,
|
|
emailFrom: "",
|
|
smtpHost: "",
|
|
smtpPort: 0,
|
|
smtpSecure: false,
|
|
smtpUser: "sender",
|
|
smtpPass: "",
|
|
}),
|
|
).toEqual({
|
|
ready: false,
|
|
reasons: ["email_from_missing", "smtp_host_missing", "smtp_port_invalid", "smtp_auth_incomplete"],
|
|
});
|
|
});
|
|
});
|