describe("Table of threats", function() {
  it("can contain a threat", function() {
    // given
    threat = {name: "steal money"};
    // when
    threats = [ threat ];
    // then
    expect(threats[0].name).toBe("steal money");
  });
  it("can make a simple tree", function() {
    // given
    tree = {branch1: 1, 
            branch2: [{twig1: 2}, {twig2: 3}]
            }
    // when
    // then
    expect(tree.branch1).toBe(1);
    expect(tree.branch2[0].twig1).toBe(2);
    expect(tree.branch2[1].twig2).toBe(3);

  });
  it("can make a fancy immutable tree", function() {
    // given
    mtree = {branch1: 1, 
            branch2: [{twig1: 2}, {twig2: 3}]
            };
    // when
    itree = I(mtree);
    // then
    expect(itree("branch1")).toBe(1);
    expect(itree("branch2")(0)("twig1")).toBe(2);
    expect(itree("branch2")(1)("twig2")).toBe(3);

  });
  it("can update immutable tree", function() {
    // given
    var itree = I({branch1: 1, 
            branch2: [{twig1: 2}, {twig2: 3}]
            });
    // when
    var i2tree = itree.set("branch1", 4);
    // then
    expect(i2tree("branch1")).toBe(4);

  });

});

@@ -1042,14 +1042,9 @@
     
-var i2
+i
 tree
@@ -1071,16 +1071,65 @@
 1%22, 4);%0A
+    itree = itree.patch(%7Bbranch2: %5B%7Btwig1:6%7D%5D%7D);%0A
     // t
@@ -1144,17 +1144,16 @@
 expect(i
-2
 tree(%22br
@@ -1169,16 +1169,66 @@
 toBe(4);
+%0A    expect(itree(%22branch2%22)(0)(%22twig1%22)).toBe(6);
 %0A%0A  %7D);%0A

use patch in order to update nested