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 = {};

    utils
      .setUpBox(boxConfig)
      .then(() => assert(false, "didn't throw!"))
      .catch(e =>
        assert(e.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,20 +251,25 @@
     
-utils
+try %7B
 %0A      
+utils
 .set
@@ -288,26 +288,15 @@
 fig)
+;
 %0A     
- .then(() =%3E
  ass
@@ -326,30 +326,32 @@
 w!%22)
-)
+;
 %0A    
+%7D
  
- .
 catch
+ 
 (e
- =%3E%0A  
+rror) %7B%0A
     
@@ -360,16 +360,20 @@
 assert(e
+rror
 .stack.m
@@ -422,17 +422,15 @@
 /g))
+;
 %0A    
-  );
+%7D
 %0A  %7D

update utils.setUpBox test case (test/utils-index.js)