From 8493c52be3cc71b110bc5d08d4531032f5a282b8 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 13 Apr 2017 12:30:50 -0700 Subject: [PATCH] joyent/node-triton#199 cli-networks.test.js crash if there are no non-public networks Reviewed by: Jason King Approved by: Jason King --- test/integration/cli-networks.test.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/integration/cli-networks.test.js b/test/integration/cli-networks.test.js index 1d822dd..dad5ef8 100644 --- a/test/integration/cli-networks.test.js +++ b/test/integration/cli-networks.test.js @@ -71,10 +71,13 @@ test('triton networks', function (tt) { function (err, stdout, stderr) { if (h.ifErr(t, err)) return t.end(); - var results = stdout.trim().split('\n'); - results.forEach(function (result) { - t.equal(false, common.boolFromString(result, null, 'public')); - }); + if (stdout.trim()) { + var results = stdout.trim().split('\n'); + results.forEach(function (result) { + t.equal(false, + common.boolFromString(result, null, 'public')); + }); + } t.end(); }); }); @@ -84,10 +87,13 @@ test('triton networks', function (tt) { function (err, stdout, stderr) { if (h.ifErr(t, err)) return t.end(); - var results = stdout.trim().split('\n'); - results.forEach(function (result) { - t.equal(false, common.boolFromString(result, null, 'public')); - }); + if (stdout.trim()) { + var results = stdout.trim().split('\n'); + results.forEach(function (result) { + t.equal(false, + common.boolFromString(result, null, 'public')); + }); + } t.end(); }); });