Skip to content

Commit

Permalink
Fix plural-zero in "Found 0 ...". Follow up to gh-793
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Jul 22, 2016
1 parent 19686e4 commit a4a23a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ controller.printAvailableNetworks = function(opts) {
// Ask Tessel what networks it finds in a scan
return tessel.findAvailableNetworks()
.then((networks) => {
log.info(`Found ${networks.length} network${networks.length > 1 ? 's' : ''} visible to ${tessel.name}:`);
log.info(`Found ${networks.length} network${networks.length !== 1 ? 's' : ''} visible to ${tessel.name}:`);

// Print out networks
networks.forEach((network) => {
Expand Down
23 changes: 23 additions & 0 deletions test/unit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,4 +1314,27 @@ exports['controller.printAvailableNetworks'] = {
});
},

listCountOfVisibleToTesselPluralZero: function(test) {
test.expect(4);

this.findAvailableNetworks = this.sandbox.stub(this.tessel, 'findAvailableNetworks', () => {
return Promise.resolve([]);
});

controller.printAvailableNetworks({})
.then(() => {

test.equal(this.info.callCount, 2);
test.equal(this.basic.callCount, 0);

test.equal(this.info.firstCall.args[0], 'Scanning for visible networks...');
test.equal(this.info.lastCall.args[0], 'Found 0 networks visible to robocop:');
test.done();
})
.catch(error => {
test.ok(false, error.toString());
test.done();
});
},

};

0 comments on commit a4a23a7

Please sign in to comment.