From 6fb903353a4362427a0a4c7db9666ca969e85f23 Mon Sep 17 00:00:00 2001 From: Morgan Allen Date: Sun, 29 Jul 2018 00:47:35 -0700 Subject: [PATCH] add spreadfactor test --- test/test.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 9ef2bc6..6db9bb9 100644 --- a/test/test.js +++ b/test/test.js @@ -157,5 +157,30 @@ async.series([ }); 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"); });