joyent/node-triton#199 cli-networks.test.js crash if there are no non-public networks

Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Jason King <jason.king@joyent.com>
This commit is contained in:
Trent Mick 2017-04-13 12:30:50 -07:00
parent b69832c227
commit 8493c52be3
1 changed files with 14 additions and 8 deletions

View File

@ -71,10 +71,13 @@ test('triton networks', function (tt) {
function (err, stdout, stderr) { function (err, stdout, stderr) {
if (h.ifErr(t, err)) if (h.ifErr(t, err))
return t.end(); return t.end();
var results = stdout.trim().split('\n'); if (stdout.trim()) {
results.forEach(function (result) { var results = stdout.trim().split('\n');
t.equal(false, common.boolFromString(result, null, 'public')); results.forEach(function (result) {
}); t.equal(false,
common.boolFromString(result, null, 'public'));
});
}
t.end(); t.end();
}); });
}); });
@ -84,10 +87,13 @@ test('triton networks', function (tt) {
function (err, stdout, stderr) { function (err, stdout, stderr) {
if (h.ifErr(t, err)) if (h.ifErr(t, err))
return t.end(); return t.end();
var results = stdout.trim().split('\n'); if (stdout.trim()) {
results.forEach(function (result) { var results = stdout.trim().split('\n');
t.equal(false, common.boolFromString(result, null, 'public')); results.forEach(function (result) {
}); t.equal(false,
common.boolFromString(result, null, 'public'));
});
}
t.end(); t.end();
}); });
}); });