npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fluid-mail-test

v1.0.8

Published

A Fluid component that provides an SMTP server and client that can be used for testing purposes.

Downloads

5

Readme

Introduction

This package provides a test mail server based on simplesmtp, and a mail client based on nodemailer-smtp-transport.

Global Functions

fluid.mail.test.loadTestingSupport()

  • Returns: Nothing.

Require the files that define our case holder and environment (see below). Allows third-parties to more easily reuse our test fixtures.

Components

fluid.test.mail.smtp

A test mail server that allows you to examine the contents of outgoing mail messages from within Fluid IoC tests. This allows you to do things like:

  1. Confirm that a link send to a user via email is actually usable.
  2. Confirm that mail message content is rendered correctly.

When a message is received, it is saved to the cache file, and then an onMessageReceived event is fired. In your tests you will typically:

  1. Send mail.
  2. Listen for the onMessageReceived event.
  3. Examine the contents of {fluid.test.mail.smtp}.currentMessageFile.

Note that the filename for the cache file is generated using a timestamp, and is located in os.tmpdir() by default.

Component Options

| Option | Type | Description | | ---------- | ---------- | ----------- | | port | {Number} | The port number to listen on. Defaults to 4025. | | simpleSmtp | {Object} | The configuration options to pass on to simplesmtp.createServer. See the simplesmtp documentation for details. |

fluid.test.mail.mailer

A wrapper around nodemailer-smtp-transport that can be used to send test messages to an arbitrary SMTP server.

Component Options

| Option | Type | Description | | ------------------ | ----------- | ----------- | | transportOptions | {Object} | Configuration options to pass on to nodemailer-smtp-transport. See their documentation for details. | | smtpPort | {Number} | The port on transportOptions.host we will attempt to connect to. |

Component Invokers

{that}.sendMessage(mailOptions)
  • mailOptions: {Object} The mail options to pass on to nodemailer-smtp-transport. The full syntax available can be found in the nodemailer documentation. See below for an example.
  • Returns: Nothing.

Send a message using nodemailer-smtp-transport. Fires onSuccess if the message is sent succesfully, or onError if the message fails. Here is an example of typical mailOptions:

{
  from:    "[email protected]",
  to:      "[email protected]",
  cc:      "[email protected]",
  subject: "Sample subject...",
  text:    "Text body of the message.\n",
  html:    "<p>HTML body of the message.</p>\n"
}

Note that the to and cc elements can also be passed an array of email addresses.

fluid.test.mail.environment

A fluid.test.testEnvironment that constructs an instance of fluid.test.mail.smtp when its constructServer event is fired. Intended for use with something like the fluid.test.mail.caseholder caseholder (see below).

Component Options

| Option | Type | Description | | ------ | ----------- | ----------- | | port | {Number} | The port the SMTP server should listen on. |

fluid.test.mail.caseholder

An instance of fluid.express.tests.caseHolder.base, which is a case holder that allows wiring in default "first steps" and "last steps" for each test. This grade includes the "startup" sequences for fluid.test.mail.environment, which launch the mail server, and then wait for it to finish starting up before continuing. If you need different startup steps, extend fluid.express.tests.caseHolder.base instead.

The only practical difference between this and a stock caseholder is that your tests should be stored in options.rawModules rather than options.modules.