add spreadfactor test

This commit is contained in:
Morgan Allen 2018-07-29 00:47:35 -07:00
parent fca72ac0f1
commit 6fb903353a

View file

@ -157,5 +157,30 @@ async.series([
}); });
ports.dev2.write(`send${message}\n`); ports.dev2.write(`send${message}\n`);
}); }, "round-trip message");
test(function(t) {
t.plan(2);
var sf = 9;
var msg = `sf${sf}\n`;
testSetSpreadFactor(ports.dev1);
testSetSpreadFactor(ports.dev2);
function testSetSpreadFactor(port) {
var buf = "";
port.on("data", function onData(c) {
buf += c.toString();
if(buf.indexOf(`spreadfactor: ${sf}`) !== -1) {
t.pass("spreadfactor set");
port.removeListener("data", onData);
}
});
port.write(msg);
};
}, "spreadfactor");
}); });