Skip to content

Commit 943284a

Browse files
committed
Fix tests
1 parent 6ed6348 commit 943284a

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/cli/usb.test.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ describe('USB Command-Line Interface', () => {
2828
'Help: particle help usb <command>',
2929
'',
3030
'Commands:',
31-
' list List the devices connected to the host computer',
32-
' start-listening Put a device into the listening mode',
33-
' listen alias for start-listening',
34-
' stop-listening Make a device exit the listening mode',
35-
' safe-mode Put a device into the safe mode',
36-
' dfu Put a device into the DFU mode',
37-
' reset Reset a device',
38-
' setup-done Set the setup done flag',
39-
' configure Update the system USB configuration',
40-
' cloud-status Check a device\'s cloud connection state',
41-
' network-interfaces Gets the network configuration of the device',
31+
' list List the devices connected to the host computer',
32+
' start-listening Put a device into the listening mode',
33+
' listen alias for start-listening',
34+
' stop-listening Make a device exit the listening mode',
35+
' safe-mode Put a device into the safe mode',
36+
' dfu Put a device into the DFU mode',
37+
' reset Reset a device',
38+
' setup-done Set the setup done flag',
39+
' configure Update the system USB configuration',
40+
' cloud-status Check a device\'s cloud connection state',
41+
' network-interfaces Gets the network configuration of the device',
4242
''
4343
].join('\n'));
4444
});
@@ -385,16 +385,21 @@ describe('USB Command-Line Interface', () => {
385385
expect(argv.clierror).to.equal(undefined);
386386
expect(argv.all).to.equal(false);
387387
});
388-
388+
389389
it('Includes help with examples', () => {
390390
commandProcessor.parse(root, ['usb', 'network-interfaces', '--help'], termWidth);
391391
commandProcessor.showHelp((helpText) => {
392392
expect(helpText).to.equal([
393393
'Gets the network configuration of the device',
394-
'Usage: particle usb network-interfaces',
394+
'Usage: particle usb network-interfaces [options] [devices...]',
395+
'',
396+
'Options:',
397+
' --all Send the command to all devices connected to the host computer [boolean]',
395398
'',
396399
'Examples:',
397-
' particle usb network-interfaces Gets the network configuration of the device',
400+
' particle usb network-interfaces Gets the network configuration of the device',
401+
' particle usb network-interfaces --all Gets the network configuration of all the devices connected over USB',
402+
' particle usb network-interfaces my_device Gets the network configuration of the device named "my_device"',
398403
''
399404
].join('\n'));
400405
});

src/cmd/usb.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const CLICommandBase = require('./base');
1111
const chalk = require('chalk');
1212

1313

14-
module.exports = class UsbCommand extends CLICommandBase {
14+
module.exports = class UsbCommand extends CLICommandBase {
1515
constructor(settings) {
1616
super();
1717
spinnerMixin(this);
@@ -302,23 +302,23 @@ module.exports = class UsbCommand extends CLICommandBase {
302302
for (let i = 0; i < Math.floor(cidr / 8); i++) {
303303
mask.push(255);
304304
}
305-
305+
306306
// Calculate remaining bits in the next octet
307307
if (mask.length < 4) {
308308
mask.push((256 - Math.pow(2, 8 - cidr % 8)) & 255);
309309
}
310-
310+
311311
// Fill the remaining octets with '0' if any
312312
while (mask.length < 4) {
313313
mask.push(0);
314314
}
315-
315+
316316
return mask.join('.');
317317
}
318318

319319
async getNetworkIfaces(args) {
320320
// define output array with logs to prevent interleaving with the spinner
321-
let output = [];
321+
let output = [];
322322

323323
await this._forEachUsbDevice(args, usbDevice => {
324324
const platform = platformForId(usbDevice.platformId);
@@ -329,9 +329,9 @@ module.exports = class UsbCommand extends CLICommandBase {
329329
return;
330330
}
331331
return this.getNetworkIface(usbDevice)
332-
.then((outputData) => {
333-
output = output.concat(outputData);
334-
});
332+
.then((outputData) => {
333+
output = output.concat(outputData);
334+
});
335335
});
336336

337337
if (output.length === 0) {

0 commit comments

Comments
 (0)