Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from antoniodots/master
bugfix issue #113: callback called multiple times with error
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var path = require('path'); | ||
var assert = require('assert'); | ||
|
||
describe("Connect to wrong email server", function() { | ||
var emailModulePath = require.resolve(path.join(__dirname, '..', 'email')); | ||
var email; | ||
|
||
beforeEach(function() { | ||
if (require.cache[emailModulePath]) { | ||
delete require.cache[emailModulePath]; | ||
} | ||
email = require('../email'); | ||
}); | ||
|
||
it("Should not call callback multiple times with wrong server configuration", function(done) { | ||
this.timeout(5000); | ||
var server = email.server.connect({ host: "bar.baz" }); | ||
server.send({ | ||
from: "foo@bar.baz", | ||
to: "foo@bar.baz", | ||
subject: "hello world", | ||
text: "hello world", | ||
}, function(err) { | ||
assert.notEqual(err, null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|