Skip to content

Commit

Permalink
try get away other callback deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed May 9, 2024
1 parent a4b6015 commit 3b30980
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions test/testSerial.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('Native libmbus node-module Serial test ...', function() {
it('Test Reading Serial', function (done) {
this.timeout(300000); // because of first install from npm

let mbusMaster;
let testSocket;
let secondaryCase = "";
const server = net.createServer(function (socket) {
Expand All @@ -38,6 +39,8 @@ describe('Native libmbus node-module Serial test ...', function() {
socket.on('data', function (data) {
let sendBuf;

expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;

if (!data) {
console.log(new Date().toString() + ': mbus-Serial-Device: Received empty string!');
return;
Expand Down Expand Up @@ -154,7 +157,7 @@ describe('Native libmbus node-module Serial test ...', function() {
serialBaudRate: 9600
};
}
const mbusMaster = new MbusMaster(mbusOptions);
mbusMaster = new MbusMaster(mbusOptions);

mbusMaster.getData(3, function(err, data) {
expect(err.message).to.be.equal('Not connected and autoConnect is false');
Expand Down Expand Up @@ -232,9 +235,6 @@ describe('Native libmbus node-module Serial test ...', function() {
});
});
});
setImmediate(() => {
expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;
});
}, 2000);
});

Expand Down
8 changes: 4 additions & 4 deletions test/testTcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Native libmbus node-module TCP test ...', function() {
it('Test Reading TCP', function (done) {
this.timeout(300000); // because of first install from npm

let mbusMaster;
let testSocket;
const server = net.createServer(function (socket) {
console.log(new Date().toString() + ': mbus-TCP-Device: Connected ' + port + '!');
Expand All @@ -33,6 +34,8 @@ describe('Native libmbus node-module TCP test ...', function() {
let sendBuf;
let counterFD = 0;

expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;

if (!data) {
console.log(new Date().toString() + ': mbus-TCP-Device: Received empty string!');
return;
Expand Down Expand Up @@ -95,7 +98,7 @@ describe('Native libmbus node-module TCP test ...', function() {
port: port,
timeout: 100
};
const mbusMaster = new MbusMaster(mbusOptions);
mbusMaster = new MbusMaster(mbusOptions);
const connectResult = mbusMaster.connect();
console.log(new Date().toString() + ': mbus-TCP-Master Open:' + connectResult);
if (!connectResult) server.close();
Expand Down Expand Up @@ -156,9 +159,6 @@ describe('Native libmbus node-module TCP test ...', function() {
});
});
});
setImmediate(() => {
expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;
});
}, 2000);
});

Expand Down
8 changes: 4 additions & 4 deletions test/testTcpIPV6.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Native libmbus node-module TCP-IPv6 test ...', function() {
it('Test Reading TCP-IPv6', function (done) {
this.timeout(300000); // because of first install from npm

let mbusMaster;
let testSocket;
const server = net.createServer(function (socket) {
console.log(new Date().toString() + ': mbus-TCPv6-Device: Connected ' + port + '!');
Expand All @@ -33,6 +34,8 @@ describe('Native libmbus node-module TCP-IPv6 test ...', function() {
let sendBuf;
let counterFD = 0;

expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;

if (!data) {
console.log(new Date().toString() + ': mbus-TCPv6-Device: Received empty string!');
return;
Expand Down Expand Up @@ -95,7 +98,7 @@ describe('Native libmbus node-module TCP-IPv6 test ...', function() {
port: port,
timeout: 100
};
const mbusMaster = new MbusMaster(mbusOptions);
mbusMaster = new MbusMaster(mbusOptions);
try {
const connectResult = mbusMaster.connect();
console.log(new Date().toString() + ': mbus-TCP-Master Open:' + connectResult);
Expand Down Expand Up @@ -161,9 +164,6 @@ describe('Native libmbus node-module TCP-IPv6 test ...', function() {
});
});
});
setImmediate(() => {
expect(mbusMaster.mbusMaster.communicationInProgress).to.be.true;
});
}, 2000);
});

Expand Down

0 comments on commit 3b30980

Please sign in to comment.