UNPKG

nodemail-aws-ses

Version:

nodemail-aws-ses is a Node.js package that provides a simple and easy way to send emails using Amazon SES (Simple Email Service). It provides an EmailSender class that takes care of sending emails using the AWS SDK, with options for both HTML and text ema

33 lines (25 loc) 988 B
const EmailSender = require("../EmailSender"); describe("EmailSender", () => { it("should instantiate the class with the correct properties", () => { const to = "recipient@example.com"; const subject = "Test Subject"; const textBody = "Test text body"; const htmlBody = "<h1>Test HTML body</h1>"; const emailSender = new EmailSender(to, subject, textBody, htmlBody); expect(emailSender.to).toEqual(to); expect(emailSender.subject).toEqual(subject); expect(emailSender.textBody).toEqual(textBody); expect(emailSender.htmlBody).toEqual(htmlBody); }); // Add more test cases here as needed }); describe("EmailSender", () => { test("should validate email format", () => { const to = "recipient@example.com"; const subject = "Test subject"; const body = "Test body"; const emailSender = new EmailSender(to, subject, body); const isValidEmail = emailSender.validateEmail(to); expect(isValidEmail).toBe(true); }); });