Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to verify standard trnsport functionality
- Loading branch information
1 parent
d3200b1
commit 176d254
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
|
||
var vows = require("vows"); | ||
var assert = require("assert"); | ||
var winston = require("winston"); | ||
var helpers = require("winston/test/helpers"); | ||
var NodeMailer = require("../index.js"); | ||
|
||
function assertMail(transport) { | ||
assert.instanceOf(transport, NodeMailer); | ||
assert.isFunction(transport.log); | ||
} | ||
|
||
var called = false; | ||
var nodeMailerTransport = { | ||
sendMail: function (optoins, cb) { | ||
called = true; | ||
cb(null); | ||
} | ||
}; | ||
|
||
var transport = new (NodeMailer)({ to: "test.@test.xx", from: "dev@server.com", transport: nodeMailerTransport }); | ||
|
||
vows.describe("winston-mail").addBatch({ | ||
"An instance of the NodeMailer Transport": { | ||
"should have the proper methods defined": function () { | ||
assertMail(transport); | ||
}, | ||
"the log() method": helpers.testNpmLevels(transport, | ||
"should log messages to NodeMailer", function (ign, err, logged) { | ||
assert.isTrue(!err); | ||
assert.isTrue(logged); | ||
assert.isTrue(called); | ||
}) | ||
} | ||
}).export(module); |