mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	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:
		@@ -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" ) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user