Skip to content

Commit 7a4ad84

Browse files
committed
updated package.json dependencies and run lintfix accordingly.
1 parent 6cbc9ec commit 7a4ad84

12 files changed

+4057
-2159
lines changed

lib/helper.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function subscribe(type, rx, cb) {
4949
} else if (type === 'rega') {
5050
regaSubscriptions[subIndex] = {rx, cb};
5151
}
52+
5253
matchSubscriptions(type);
5354
return subIndex;
5455
}
@@ -63,9 +64,11 @@ function matchSubscriptions(type, data) {
6364
subs = regaSubscriptions;
6465
buf = regaBuffer;
6566
}
67+
6668
if (data) {
6769
buf.push(data);
6870
}
71+
6972
buf.forEach(function (line, index) {
7073
Object.keys(subs).forEach(function (key) {
7174
const sub = subs[key];
@@ -101,12 +104,14 @@ function startSim() {
101104
if (simOutput) {
102105
console.log('sim', data.toString());
103106
}
107+
104108
matchSubscriptions('sim', data.toString());
105109
});
106110
simPipeErr.on('token', function (data) {
107111
if (simOutput) {
108112
console.log('sim', data.toString());
109113
}
114+
110115
matchSubscriptions('sim', data.toString());
111116
});
112117
}
@@ -116,29 +121,34 @@ function startRega(flavor, faketime, nocopy = false) {
116121
if (nocopy === false) {
117122
cp.execSync('/bin/cp ' + path.join(__dirname, '..', 'homematic.regadom') + ' /etc/config/');
118123
}
124+
119125
regaSubscriptions = {};
120126
regaBuffer = [];
121127
if (!flavor) {
122128
flavor = '.' + process.env.FLAVOR;
123129
}
130+
124131
if (faketime) {
125132
procs.rega = cp.spawn('unbuffer', ['/bin/faketime', faketime, '/bin/ReGaHss' + flavor, '-c', '-l', '0', '-f', '/etc/rega.conf']);
126133
} else {
127134
procs.rega = cp.spawn('unbuffer', ['/bin/ReGaHss' + flavor, '-c', '-l', '0', '-f', '/etc/rega.conf']);
128135
}
136+
129137
// Console.log('spawned /bin/ReGaHss' + flavor + ' (pid ' + procs.rega.pid + ')');
130138
const regaPipeOut = procs.rega.stdout.pipe(streamSplitter('\n'));
131139
const regaPipeErr = procs.rega.stderr.pipe(streamSplitter('\n'));
132140
regaPipeOut.on('token', function (data) {
133141
if (regaOutput) {
134142
console.log('ReGaHss', data.toString());
135143
}
144+
136145
matchSubscriptions('rega', data.toString());
137146
});
138147
regaPipeErr.on('token', function (data) {
139148
if (regaOutput) {
140149
console.log('ReGaHss', data.toString());
141150
}
151+
142152
matchSubscriptions('rega', data.toString());
143153
});
144154
}
@@ -218,7 +228,7 @@ function initTest(flavor, sim = true, time = null, rpc = null, nocopy = false) {
218228
step('should do init on simulated rfd', function (done) {
219229
this.slow(10000);
220230
this.timeout(30000);
221-
subscribe('sim', /rpc rfd < init \["xmlrpc_bin:\/\/127\.0\.0\.1:31999","[0-9]+"]/, function () {
231+
subscribe('sim', /rpc rfd < init \["xmlrpc_bin:\/\/127\.0\.0\.1:31999","\d+"]/, function () {
222232
done();
223233
});
224234
});
@@ -257,6 +267,7 @@ function cleanupTest(flavor) {
257267
cp.spawnSync('killall', ['-9', 'ReGaHss' + flavor]);
258268
});
259269
}
270+
260271
if (simulatorStarted === true) {
261272
simulatorStarted = false;
262273
it('should stop rfd/hmipserver simulator', function (done) {
@@ -265,6 +276,7 @@ function cleanupTest(flavor) {
265276
done();
266277
});
267278
}
279+
268280
if (rpcClientStarted === true) {
269281
rpcClientStarted = false;
270282
it('should disconnect rpc client', function (done) {

0 commit comments

Comments
 (0)