add exchange test

this ensure continuous rx is reenabled
This commit is contained in:
Morgan Allen 2018-07-29 00:48:32 -07:00
parent 6fb903353a
commit db74ecbfb9

View file

@ -183,4 +183,34 @@ async.series([
port.write(msg);
};
}, "spreadfactor");
test(function(t) {
t.plan(4);
var i = 0;
async.doUntil(function(done) {
var write = ports["dev" + (1 + i % 2)];
var read = ports["dev" + (1 + (i + 1) % 2)];
var buf = "";
var msg = `tick${i}`;
read.on("data", function onData(c) {
buf += c.toString();
if(buf.indexOf(msg) !== -1) {
t.pass("got message " + i);
read.removeListener("data", onData);
done(null);
}
});
write.write(`send${msg}\n`);
}, function() {
return ++i > 5;
})
}, "exchange");
});