Skip to content

Commit 68b5f65

Browse files
committed
Linting codebase
- Remove console.error statements. - Allow for disabled tests. - remove unused comparision
1 parent 03779ba commit 68b5f65

File tree

5 files changed

+5
-33
lines changed

5 files changed

+5
-33
lines changed

lib/services/devices/deviceService.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ function executeWithSecurity(requestOptions, deviceData, callback) {
334334
callback(new errors.SecurityInformationMissing(typeInformation.type));
335335
}
336336
else {
337-
338-
// console.error(JSON.stringify(requestOptions, null, 4));
339337
requestOptions.headers[config.getConfig().authentication.header] = token;
340338
request(requestOptions, callback);
341339
}
@@ -345,7 +343,6 @@ function executeWithSecurity(requestOptions, deviceData, callback) {
345343
typeInformation ? typeInformation.type : deviceData.type));
346344
}
347345
} else {
348-
// console.error(JSON.stringify(requestOptions, null, 4));
349346
request(requestOptions, callback);
350347
}
351348
});
@@ -453,9 +450,6 @@ function createInitialEntityNgsi2(deviceData, newDevice, callback) {
453450
value: moment()
454451
};
455452
}
456-
457-
// console.error(JSON.stringify(options, null, 4));
458-
459453
logger.debug(context, 'Creating initial entity in the Context Broker:\n %s', JSON.stringify(options, null, 4));
460454
executeWithSecurity(options, newDevice, createInitialEntityHandlerNgsi2(deviceData, newDevice, callback));
461455
}

lib/services/ngsi/ngsiService.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,6 @@ function sendUpdateValueNgsiLD(entityName, attributes, typeInformation, token, c
893893
logger.debug(context, 'Updating device value in the Context Broker at [%s]', options.url);
894894
logger.debug(context, 'Using the following NGSI-LD request:\n\n%s\n\n', JSON.stringify(options, null, 4));
895895

896-
// console.error(JSON.stringify(options.json, null, 4))
897-
898896
request(options,
899897
generateNGSILDOperationHandler('update', entityName, typeInformation, token, options, callback));
900898
}
@@ -975,16 +973,9 @@ function sendUpdateValueNgsi1(entityName, attributes, typeInformation, token, ca
975973

976974
}
977975

978-
979-
980-
981-
982976
logger.debug(context, 'Updating device value in the Context Broker at [%s]', options.url);
983977
logger.debug(context, 'Using the following NGSI-v1 request:\n\n%s\n\n', JSON.stringify(options, null, 4));
984978

985-
986-
// console.error(JSON.stringify(options.json, null, 4))
987-
988979
request(options,
989980
generateNGSIOperationHandler('update', entityName, typeInformation, token, options, callback));
990981
}

lib/services/ngsi/subscriptionService.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ function subscribeNgsi1(device, triggers, content, callback) {
198198
* @param {Object} content Array with the names of the attributes to retrieve in the notification.
199199
*/
200200
function subscribeNgsi2(device, triggers, content, callback) {
201-
202-
// console.error(device);
203201
var options = {
204202
method: 'POST',
205203
headers: {
@@ -243,8 +241,6 @@ function subscribeNgsi2(device, triggers, content, callback) {
243241
} else {
244242
options.uri = config.getConfig().contextBroker.url + '/v2/subscriptions';
245243
}
246-
247-
// console.error(JSON.stringify(options));
248244
deviceService.executeWithSecurity(options,
249245
device, createSubscriptionHandlerNgsi2(device, triggers, store, callback));
250246
}
@@ -259,18 +255,14 @@ function subscribeNgsi2(device, triggers, content, callback) {
259255
* @param {Object} triggers Array with the names of the attributes that would trigger the subscription
260256
* @param {Object} content Array with the names of the attributes to retrieve in the notification.
261257
*/
262-
function subscribeNgsiLD(device, triggers, content, callback) {
263-
264-
// console.error(JSON.stringify(device))
265-
266-
258+
function subscribeNgsiLD(device, triggers, content, callback) {
267259
var options = {
268260
method: 'POST',
269261
headers: {
270262
'fiware-service': device.service
271263
},
272264
json: {
273-
type: "Subscription",
265+
type: 'Subscription',
274266
entities: [
275267
{
276268
id: device.name,
@@ -301,8 +293,6 @@ function subscribeNgsiLD(device, triggers, content, callback) {
301293
} else {
302294
options.uri = config.getConfig().contextBroker.url + '/ngsi-ld/v1/subscriptions/';
303295
}
304-
305-
// console.error(JSON.stringify(options));
306296
deviceService.executeWithSecurity(options,
307297
device, createSubscriptionHandlerNgsi2(device, triggers, store, callback));
308298
}
@@ -320,7 +310,6 @@ function subscribe(device, triggers, content, callback) {
320310
if (config.checkNgsiLD()) {
321311
subscribeNgsiLD(device, triggers, content, callback);
322312
} else if (config.checkNgsi2()) {
323-
// console.error(device);
324313
subscribeNgsi2(device, triggers, content, callback);
325314
} else {
326315
subscribeNgsi1(device, triggers, content, callback);

test/.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
},
3131
"predef":
3232
[
33-
"describe", "beforeEach", "afterEach", "it"
33+
"describe", "beforeEach", "afterEach", "it", "xdescribe", "xit"
3434
]
3535
}

test/unit/ngsi-ld/general/https-support-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,8 @@ describe('NGSI-LD - HTTPS support tests', function() {
230230
.matchHeader('fiware-service', 'smartGondor')
231231
.post('/ngsi-ld/v1/entityOperations/upsert/')
232232
.reply(200);
233-
234-
var nockBody = utils.readExampleFile(
235-
'./test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json');
236-
contextBrokerMock
233+
234+
contextBrokerMock = nock('https://192.168.1.1:1026')
237235
.matchHeader('fiware-service', 'smartGondor')
238236
.post('/ngsi-ld/v1/csourceRegistrations/')
239237
.reply(201, null, {'Location': '/v2/registrations/6319a7f5254b05844116584d'});

0 commit comments

Comments
 (0)