node-red/node-red-node-test-helper

credentials is undefined

enorfelt opened this issue · 2 comments

How do I use testCredentials?

I supply credentials like this in my test:

var credentials = {
userid: "username",
apikey: "password",
};
helper.load(bfApiReq, flow, credentials, function () {

Then in my node this.credentials.userid is undefined.

I think I figured it out. You have do define witch flow the credentials belong to.
Like this:

var credentials = {
      n1: {
        userid: "username",
        apikey: "password",
      },
    };

This needs to be in docs!