mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fix email tests and add one for MTA node
This commit is contained in:
parent
14087a9f77
commit
ef1ebe7b44
@ -518,7 +518,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
|
||||
function emailMtaNode(n) {
|
||||
function EmailMtaNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.port = n.port;
|
||||
var node = this;
|
||||
@ -573,6 +573,6 @@ module.exports = function(RED) {
|
||||
node.mta.close();
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("e-mail mta",emailMtaNode);
|
||||
RED.nodes.registerType("e-mail mta",EmailMtaNode);
|
||||
|
||||
};
|
||||
|
@ -43,6 +43,7 @@ describe('email Node', function () {
|
||||
id: "n1",
|
||||
type: "e-mail",
|
||||
name: "emailout",
|
||||
port: 1025,
|
||||
wires: [
|
||||
[]
|
||||
]
|
||||
@ -188,4 +189,59 @@ describe('email Node', function () {
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
describe('email mta', function () {
|
||||
|
||||
it('should catch an email send to localhost 1025', function (done) {
|
||||
var flow = [{
|
||||
id: "n1",
|
||||
type: "e-mail mta",
|
||||
name: "emailmta",
|
||||
port: 1025,
|
||||
wires: [
|
||||
["n2"]
|
||||
]
|
||||
},
|
||||
{
|
||||
id:"n2",
|
||||
type:"helper"
|
||||
},
|
||||
{
|
||||
id: "n3",
|
||||
type: "e-mail",
|
||||
dname: "testout",
|
||||
server: "localhost",
|
||||
secure: false,
|
||||
port: 1025,
|
||||
wires: [
|
||||
[]
|
||||
]
|
||||
}];
|
||||
helper.load(emailNode, flow, function () {
|
||||
var n1 = helper.getNode("n1");
|
||||
var n2 = helper.getNode("n2");
|
||||
var n3 = helper.getNode("n3");
|
||||
n1.should.have.property('port', 1025);
|
||||
|
||||
n2.on("input", function(msg) {
|
||||
//console.log("GOT",msg);
|
||||
msg.should.have.a.property("payload",'Hello World\n');
|
||||
msg.should.have.a.property("topic","Test");
|
||||
msg.should.have.a.property("from",'foo@example.com');
|
||||
msg.should.have.a.property("to",'bar@example.com');
|
||||
msg.should.have.a.property("attachments");
|
||||
msg.should.have.a.property("header");
|
||||
done();
|
||||
});
|
||||
|
||||
n3.emit("input", {
|
||||
payload: "Hello World",
|
||||
topic: "Test",
|
||||
from: "foo@example.com",
|
||||
to: "bar@example.com"
|
||||
});
|
||||
//done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user