<commit_before>describe("NodeListCollection", function() {
  $a = window.beats;
  var models;
  var network;
  
  beforeEach(function() {
    spyOn($a.NodeListCollection.prototype, 'clear').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'clearSelected').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addNode').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addLink').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addConnectingLinkDest').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addConnectingLinkOrigin').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addLinkOrigin').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'addLinkDest').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'removeNode').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'removeNodeAndLinks').andCallThrough();
    spyOn($a.NodeListCollection.prototype, 'removeNodeAndJoinLinks').andCallThrough();
    this.nColl = new $a.NodeListCollection(scenarioAndFriends().scenario.nodes());
   
  });
  
  describe("Instantiation", function() {
       it("sets models to a collection of nodes", function() {
         expect(this.nColl.models).not.toBeNull();
       });
       it("sets all its models selected attribute to false", function() {
         mod = this.nColl.models;
         arrSel = mod.filter(function(node){ return node.get('selected') === false});
         expect(arrSel.length).toEqual(this.nColl.length);
       });
       it("should be watching clear", function() {
         $a.broker.trigger("map:clear_map");
         expect($a.NodeListCollection.prototype.clear).toHaveBeenCalled();
       });
       it("should be watching clearSelected", function() {
         $a.broker.trigger('map:clear_selected');
         expect($a.NodeListCollection.prototype.clearSelected).toHaveBeenCalled();
       })
       it("should be watching addNode", function() {
         $a.broker.trigger("nodes:add", new google.maps.LatLng(35,-122));
         expect($a.NodeListCollection.prototype.addNode).toHaveBeenCalled();
       });
       it("should be watching addLink", function() {
         this.nColl.trigger("nodes:add_link", new google.maps.LatLng(37,-123));
         expect($a.NodeListCollection.prototype.addLink).toHaveBeenCalled();
       });
       it("should be watching addConnectingLinkDest", function() {
         this.nColl.trigger('nodes:add_connecting_link_dest', new google.maps.LatLng(37,-125));
         expect($a.NodeListCollection.prototype.addConnectingLinkDest).toHaveBeenCalled();
       });
       it("should be watching addLinkDest", function() {
         this.nColl.trigger("nodes:add_dest", new google.maps.LatLng(36,-122));
         expect($a.NodeListCollection.prototype.addLinkDest).toHaveBeenCalled();
       });
       it("should be watching addConnectingLinkOrigin", function() {
         this.nColl.trigger("nodes:add_connecting_link_orig", new google.maps.LatLng(37,-125));
         expect($a.NodeListCollection.prototype.addConnectingLinkOrigin).toHaveBeenCalled();
       });
       it("should be watching addLinkDest", function() {
         this.nColl.trigger("nodes:add_dest", new google.maps.LatLng(36,-122));
         expect($a.NodeListCollection.prototype.addLinkDest).toHaveBeenCalled();
       });
       it("should be watching removeNode", function() {
         $a.broker.trigger("nodes:remove", this.nColl.models[0].cid);
         expect($a.NodeListCollection.prototype.removeNode).toHaveBeenCalled();
       });
       it("should be watching removeNodeAndJoinLinks", function() {
         $a.broker.trigger("nodes:remove_and_join", this.nColl.models[0].cid);
         expect($a.NodeListCollection.prototype.removeNodeAndJoinLinks).toHaveBeenCalled();
       });
       it("should be watching removeNodeAndLinks", function() {
         $a.broker.trigger("nodes:remove_and_links", this.nColl.models[0].cid);
         expect($a.NodeListCollection.prototype.removeNodeAndLinks).toHaveBeenCalled();
       });
  });
     
  describe("getBrowserColumnData", function() {
     it("should return id, name, type for editor browser table", function() {
       arrColumnsData = this.nColl.getBrowserColumnData();
       expect(arrColumnsData[0][0]).toEqual(this.nColl.models[0].ident());
       expect(arrColumnsData[0][1]).toEqual(this.nColl.models[0].name());
       expect(arrColumnsData[0][2]).toEqual(this.nColl.models[0].type_name());
     });
  });
     
  describe("setSelected ", function() {
     it("should sets the select field to true", function() {
       mod = this.nColl.models;
       this.nColl.setSelected(mod);
       arrSel = mod.filter(function(node){ return node.get('selected') == true});
       expect(arrSel.length).toEqual(this.nColl.length);
       this.nColl.clearSelected();
     });
  });
     
  describe("clearSelected ", function() {
     it("should sets the select field to false", function() {
       mod = this.nColl.models;
       this.nColl.clearSelected();
       arrSel = mod.filter(function(node){ return node.get('selected') == false});
       expect(arrSel.length).toEqual(this.nColl.length);
     });
  });
     
  describe("addNode ", function() {
    it("should create a new node and add it to the collection", function() {
     var lengthBefore = this.nColl.length;
     this.nColl.addNode(new google.maps.LatLng(37,-122));
     expect(lengthBefore + 1).toEqual(this.nColl.length);
    });
    it("should create a new node and add it to the models schema", function() {
     var lengthBefore = $a.models.nodes().length;
     this.nColl.addNode(new google.maps.LatLng(37,-122));
     expect(lengthBefore + 1).toEqual($a.models.nodes().length);
    });
  });

   describe("addLink", function() {
     it("should create a new node and trigger an add link", function() {
       var lengthBefore = this.nColl.length;
       this.nColl.models[0].set('selected', true)
       this.nColl.addLink(new google.maps.LatLng(37,-122));
       expect(lengthBefore + 1).toEqual(this.nColl.length);
     });
   });
   
   describe("addLinkOrigin", function() {
     it("should create a new orgin node and trigger an add link", function(){
       var lengthBefore = this.nColl.length;
       this.nColl.models[0].set('selected', true)
       this.nColl.addLinkOrigin(new google.maps.LatLng(37,-122), 'terminal');
       expect(lengthBefore + 1).toEqual(this.nColl.length);
     });
   });
   
   describe("addConnectingLinkOrigin", function() {
     it("should use selected and clicked node to create a link", function() {
       this.nColl.models[0].set('selected', true)
       this.nColl.addConnectingLinkOrigin(this.nColl.models[1].cid)
     });
   });
   describe("addConnectingLinkDest", function() {
     it("should use selected and clicked node to create a link", function() {
       this.nColl.models[0].set('selected', true)
       this.nColl.addConnectingLinkDest(this.nColl.models[1].cid)
     });
   });
   
   describe("addLinkDest", function() {<commit_msg>Added two more specs to NodeListCollectionSpec<commit_after>describe("NodeListCollection", function() {
  $a = window.beats;
  var models;
  var network;
  
  beforeEach(function() {
    nlc = $a.NodeListCollection.prototype;
    spyOn($a.LinkListCollection.prototype, 'addLink');
    spyOn(nlc, 'clear').andCallThrough();
    spyOn(nlc, 'clearSelected').andCallThrough();
    spyOn(nlc, 'addNode').andCallThrough();
    spyOn(nlc, 'addLink').andCallThrough();
    spyOn(nlc, 'addConnectingLinkDest').andCallThrough();
    spyOn(nlc, 'addConnectingLinkOrigin').andCallThrough();
    spyOn(nlc, 'addLinkOrigin').andCallThrough();
    spyOn(nlc, 'addLinkDest').andCallThrough();
    spyOn(nlc, 'removeNode').andCallThrough();
    spyOn(nlc, 'removeNodeAndLinks').andCallThrough();
    spyOn(nlc, 'removeNodeAndJoinLinks').andCallThrough();
    model = scenarioAndFriends().scenario
    this.nColl = new $a.NodeListCollection(model.nodes());
    this.lColl = new window.beats.LinkListCollection(model.links());
   
  });
  
  describe("Instantiation", function() {
       latLng = new google.maps.LatLng(37,-125);
       it("sets models to a collection of nodes", function() {
         expect(this.nColl.models).not.toBeNull();
       });
       it("sets all its models selected attribute to false", function() {
         mod = this.nColl.models;
         arrSel = mod.filter(function(node){ 
           return node.get('selected') === false
         });
         expect(arrSel.length).toEqual(this.nColl.length);
       });
       it("should be watching clear", function() {
         $a.broker.trigger("map:clear_map");
         expect(nlc.clear).toHaveBeenCalled();
       });
       it("should be watching clearSelected", function() {
         $a.broker.trigger('map:clear_selected');
         expect(nlc.clearSelected).toHaveBeenCalled();
       })
       it("should be watching addNode", function() {
         $a.broker.trigger("nodes:add", new google.maps.LatLng(35,-122));
         expect(nlc.addNode).toHaveBeenCalled();
       });
       it("should be watching addLink", function() {
         this.nColl.trigger("nodes:add_link", new google.maps.LatLng(37,-123));
         expect(nlc.addLink).toHaveBeenCalled();
       });
       it("should be watching addConnectingLinkDest", function() {
         this.nColl.trigger('nodes:add_connecting_link_dest', latLng);
         expect(nlc.addConnectingLinkDest).toHaveBeenCalled();
       });
       it("should be watching addLinkDest", function() {
         this.nColl.trigger("nodes:add_dest", new google.maps.LatLng(36,-122));
         expect(nlc.addLinkDest).toHaveBeenCalled();
       });
       it("should be watching addConnectingLinkOrigin", function() {
         this.nColl.trigger("nodes:add_connecting_link_orig", latLng);
         expect(nlc.addConnectingLinkOrigin).toHaveBeenCalled();
       });
       it("should be watching addLinkDest", function() {
         this.nColl.trigger("nodes:add_dest", new google.maps.LatLng(36,-122));
         expect(nlc.addLinkDest).toHaveBeenCalled();
       });
       it("should be watching removeNode", function() {
         $a.broker.trigger("nodes:remove", this.nColl.models[0].cid);
         expect(nlc.removeNode).toHaveBeenCalled();
       });
       it("should be watching removeNodeAndJoinLinks", function() {
         $a.broker.trigger("nodes:remove_and_join", this.nColl.models[0].cid);
         expect(nlc.removeNodeAndJoinLinks).toHaveBeenCalled();
       });
       it("should be watching removeNodeAndLinks", function() {
         $a.broker.trigger("nodes:remove_and_links", this.nColl.models[0].cid);
         expect(nlc.removeNodeAndLinks).toHaveBeenCalled();
       });
  });
     
  describe("getBrowserColumnData", function() {
     it("should return id, name, type for editor browser table", function() {
       arrColumnsData = this.nColl.getBrowserColumnData();
       expect(arrColumnsData[0][0]).toEqual(this.nColl.models[0].ident());
       expect(arrColumnsData[0][1]).toEqual(this.nColl.models[0].name());
       expect(arrColumnsData[0][2]).toEqual(this.nColl.models[0].type_name());
     });
  });
     
  describe("setSelected ", function() {
     it("should sets the select field to true", function() {
       mod = this.nColl.models;
       this.nColl.setSelected(mod);
       arrSel = mod.filter(function(node){ return node.get('selected') == true});
       expect(arrSel.length).toEqual(this.nColl.length);
       this.nColl.clearSelected();
     });
  });
     
  describe("clearSelected ", function() {
     it("should sets the select field to false", function() {
       mod = this.nColl.models;
       this.nColl.clearSelected();
       arrSel = mod.filter(function(node){ 
         return node.get('selected') == false
       });
       expect(arrSel.length).toEqual(this.nColl.length);
     });
  });
     
  describe("addNode ", function() {
    it("should create a new node and add it to the collection", function() {
     var lengthBefore = this.nColl.length;
     this.nColl.addNode(new google.maps.LatLng(37,-122));
     expect(lengthBefore + 1).toEqual(this.nColl.length);
    });
    it("should create a new node and add it to the models schema", function() {
     var lengthBefore = $a.models.nodes().length;
     this.nColl.addNode(new google.maps.LatLng(37,-122));
     expect(lengthBefore + 1).toEqual($a.models.nodes().length);
    });
  });

   describe("addLink", function() {
     it("should create a new node and trigger an add link", function() {
       var lengthBefore = this.nColl.length;
       this.nColl.models[0].set('selected', true)
       this.nColl.addLink(new google.maps.LatLng(37,-122));
       expect(lengthBefore + 1).toEqual(this.nColl.length);
     });
   });
   
   describe("addLinkOrigin", function() {
     it("should create a new orgin node and trigger an add link", function(){
       var lengthBefore = this.nColl.length;
       this.nColl.models[0].set('selected', true)
       this.nColl.addLinkOrigin(new google.maps.LatLng(37,-122), 'terminal');
       expect(lengthBefore + 1).toEqual(this.nColl.length);
     });
   });
   
   describe("addConnectingLinkOrigin", function() {
     it("should use selected and clicked node to create a link", function() {
       this.nColl.models[0].set('selected', true)
       this.nColl.addConnectingLinkOrigin(this.nColl.models[1].cid)
       expect($a.LinkListCollection.prototype.addLink).toHaveBeenCalled();
     });
   });
   describe("addConnectingLinkDest", function() {
     it("should use selected and clicked node to create a link", function() {
       this.nColl.models[0].set('selected', true)
       this.nColl.addConnectingLinkDest(this.nColl.models[1].cid)
       expect($a.LinkListCollection.prototype.addLink).toHaveBeenCalled();

     });
   });
   
   describe("addLinkDest", function() {
{'fraction_non_alphanumeric': 0.15455069955286313, 'fraction_numerical': 0.010024520409635078, 'mean_word_length': 3.46027661627533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375644', 'n_tokens_mistral': 4209, 'n_tokens_neox': 4176, 'n_words': 679}