// Copyright (c) 2017 The Regents of the University of Michigan.
// All Rights Reserved. Licensed according to the terms of the Revised
// BSD License. See LICENSE.txt for details.

const log_tree = require("../lib/log_tree");

describe("a log_tree object", function() {
  var tree;

  describe("when created from nothing", function() {
    beforeEach(function() {
      tree = log_tree();
    });

    it("has a length of 0", function() {
      expect(tree.length()).toBe(0);
    });
  });

  it("can be created with a name", function() {
    tree = log_tree("name");
  });
});

// Copyright (c) 2017 The Regents of the University of Michigan.
// All Rights Reserved. Licensed according to the terms of the Revised
// BSD License. See LICENSE.txt for details.

const log_tree = require("../lib/log_tree");

describe("a log_tree object", function() {
  var tree;

  describe("when created from nothing", function() {
    it("has a length of 0", function() {
      tree = log_tree();
      expect(tree.length()).toBe(0);
    });
  });

  it("can be created with a name", function() {
    tree = log_tree("name");
  });
});

--- 
+++ 
@@ -8,8 +8,11 @@
   var tree;
 
   describe("when created from nothing", function() {
+    beforeEach(function() {
+      tree = log_tree();
+    });
+
     it("has a length of 0", function() {
-      tree = log_tree();
       expect(tree.length()).toBe(0);
     });
   });
:art: Split test into setup and assertion
