const assert = require("assert");
const utils = require("../lib/utils");
const sinon = require("sinon");
const tmp = require("tmp");

describe("utils", () => {
  it("setUpBox throws when passed an invalid boxConfig", () => {
    let boxConfig = {};

    try {
      utils.setUpBox(boxConfig);
      assert(false, "didn't throw!");
    } catch (error) {
      assert(error.stack.match(/(Error:).*(post-unpack).*(undefined)/g));
    }
  });

  it("setUpTempDirectory throws when tmpDir creation fails", () => {
    sinon.stub(tmp, "dirSync").throws();
    assert.throws(() => {
      utils.setUpTempDirectory();
    }, "should have thrown!");
    tmp.dirSync.restore();
  });
});

@@ -251,11 +251,27 @@
     
-try
+assert.throws(() =%3E
  %7B%0A 
@@ -310,143 +310,34 @@
     
-  assert(false, %22didn't throw!%22);%0A    %7D catch (error) %7B%0A      assert(error.stack.match(/(Error:).*(post-unpack).*(undefined)/g));%0A    %7D
+%7D, %22should have thrown!%22);
 %0A  %7D

simplify setUpBox test logic (test/utils-index.js)