DefinitelyTyped/types/winston-mail/winston-mail-tests.ts
Sorin Sandru 564b0ff631 Add types for winston-mail (#27128)
* Add types for winston-mail

* added winston dependency

Created a package.json file with winston dependency

* Changed dependency in package.json

Changed dependency in package.json to winston  2.3.9 and higher.
2018-07-13 12:47:26 -07:00

54 lines
1.2 KiB
TypeScript

import winstonMail = require("winston-mail");
import winston = require("winston");
import { Transform } from "stream";
let mail: winstonMail.Mail = new winstonMail.Mail({ to: "test" });
winston.add(mail);
// $ExpectError
mail = new winstonMail.Mail({});
let mailOptions: winstonMail.MailTransportOptions = {
name: "test",
to: "test",
from: "test",
level: "test",
silent: true,
handleExceptions: true,
host: "test",
port: 10202,
username: "test",
password: "test",
subject: "test",
ssl: false,
tls: false,
unique: false,
filter: (obj: { level: string; message: string; meta: any }): boolean => {
return false;
},
html: true,
timeout: 5000,
authentication: ["test"],
formatter: (obj: { level: string; message: string; meta: any }): string => {
return "test";
}
};
mailOptions = {
to: "test",
ssl: { key: "test", ca: "test", cert: "test" },
tls: { ciphers: "test" }
};
mail = new winstonMail.Mail(mailOptions);
mailOptions = {
test: "test" // $ExpectError
};
let transport: winston.TransportInstance = new winstonMail.Mail({ to: "test" });
transport = winston.transports.Console;
mail.log("test", "test", "test", "test");