Unit Tests for Email Out

Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded.
This commit is contained in:
wooferguy 2023-02-20 21:09:48 +13:00
parent 2a18d72c15
commit 84f4dd586e
2 changed files with 6 additions and 3 deletions

View File

@ -53,6 +53,8 @@ module.exports = function(RED) {
if (globalkeys) {
this.userid = globalkeys.user;
flag = true;
} else {
this.error(RED._("email.errors.nouserid"));
}
}
if(this.authtype === "BASIC" ) {

View File

@ -70,6 +70,7 @@ describe('email Node', function () {
helper.load(emailNode, flow, function () {
var n1 = helper.getNode("n1");
n1.should.have.property('name', "emailout");
n1.should.have.property("authtype", "BASIC");
done();
});
});
@ -102,7 +103,7 @@ describe('email Node', function () {
//console.log(helper.log());
//logEvents.should.have.length(3);
logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.toString().should.startWith("email.errors.nopayload");
logEvents[2][0].msg.toString().should.startWith("email.errors.nopayload");
done();
} catch (e) {
done(e);
@ -153,7 +154,7 @@ describe('email Node', function () {
// console.log(logEvents[0][0].msg.toString());
//logEvents.should.have.length(3);
logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.toString().should.startWith("Error:");
logEvents[2][0].msg.toString().should.startWith("Error:");
done();
} catch (e) {
done(e);
@ -198,7 +199,7 @@ describe('email Node', function () {
//console.log(helper.log().args);
//logEvents.should.have.length(3);
logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.toString().should.startWith("Error:");
logEvents[2][0].msg.toString().should.startWith("Error:");
done();
} catch (e) {
done(e);