From 2837a2920481fb5c39d6efa11ef40657fd670d13 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Sat, 22 Oct 2016 16:41:32 +0200 Subject: [PATCH] Add definition for "nodemailer-stub-transport". --- .../nodemailer-stub-transport-tests.ts | 8 ++++ .../nodemailer-stub-transport.d.ts | 38 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 nodemailer-stub-transport/nodemailer-stub-transport-tests.ts create mode 100644 nodemailer-stub-transport/nodemailer-stub-transport.d.ts diff --git a/nodemailer-stub-transport/nodemailer-stub-transport-tests.ts b/nodemailer-stub-transport/nodemailer-stub-transport-tests.ts new file mode 100644 index 0000000000..ab29823588 --- /dev/null +++ b/nodemailer-stub-transport/nodemailer-stub-transport-tests.ts @@ -0,0 +1,8 @@ +/// + +import nodemailer = require("nodemailer"); +import stubTransport = require("nodemailer-stub-transport"); + +var transport = nodemailer.createTransport(stubTransport()); +nodemailer.createTransport(stubTransport({ error: new Error('Invalid recipient') })); +transport = nodemailer.createTransport(stubTransport({ keepBcc: true })); diff --git a/nodemailer-stub-transport/nodemailer-stub-transport.d.ts b/nodemailer-stub-transport/nodemailer-stub-transport.d.ts new file mode 100644 index 0000000000..36eca75240 --- /dev/null +++ b/nodemailer-stub-transport/nodemailer-stub-transport.d.ts @@ -0,0 +1,38 @@ +// Type definitions for nodemailer-stub-transport v1.1.0 +// Project: https://github.com/andris9/nodemailer-stub-transport +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "nodemailer-stub-transport" { + import * as nodemailer from "nodemailer"; + + namespace StubTransportStatic { + /** + * Options. + * @interface + */ + export interface Options { + /** + * Specifies a custom error. + * @type {any} + */ + error?: any; + + /** + * Value that indicates if the BCC addresses must be included in generated message. + * @type {boolean} + */ + keepBcc?: boolean; + } + } + + /** + * Creates a stub transport. + * @param {Options} [options] Options. + * @return {Transport} The stub transport. + */ + function stubTransport(options?: StubTransportStatic.Options): nodemailer.Transport; + export = stubTransport; +}