Hello, i have a problem with a unit test.
The node i develope sends msg in a loop like this:
for( let i = 0; i < array.lenght; i++){
node.send([array[i], null, null,]);
}
Unit Test:
it('should get data (Array)', function (done) {
const flow = getDefaultFlow();
helper.load([CheckNode, serverNode], flow, function () {
var nCheck = helper.getNode("Check");
var nhelp = helper.getNode("Help");
nCheck .receive({
payload: false
});
nhelp.on("input", function(msg) {
try {
msg.should.have.property('topic', "Data");
done();
} catch (err) {
console.log('err ' + err);
done(err);
}
});
nCheck.receive({
payload: true
});
});
});
My problem is that if i just send only one msg in the loop the test is working, but if i send multiple msg in the loop i get the error:
done() called multiple times
Can somebody tell me what i`m doing wrong?