<commit_before>describe("SensorSet", function() {
  
  beforeEach(function() {
    s = new window.beats.SensorSet();
  });
  
  describe("Default Attributes", function() {
    it("should be set", function() {
      expect(s.name()).toEqual('');  
      expect(s.description_text()).toEqual('');
      expect(s.ident()).toEqual(null);
      expect(s.project_id()).toEqual(null);
      expect(s.sensors().length).toEqual(0);
      expect(s.locked_for_edit()).toBeFalsy();
      expect(s.locked_for_history()).toBeFalsy();
      expect(s.crud()).toEqual(window.beats.CrudFlag.CREATE);
    });
  });
  
  describe("Attributes", function() {
    it("should be set", function() {
      s.set_name('SS test');
      expect(s.name()).toEqual('SS test');
      
      s.set_description_text('SS Desc');
      expect(s.description_text()).toEqual('SS Desc');
      
      s.set_id(12);
      expect(s.ident()).toEqual(12);
      
      s.set_project_id(12);
      expect(s.project_id()).toEqual(12);
      
      s.set_sensors([new window.beats.Sensor()]);
      expect(s.sensors().length).toEqual(1);
      
      s.set_locked_for_edit(true)
      expect(s.locked_for_edit()).toBeTruthy();

      s.set_locked_for_history(true)
      expect(s.locked_for_history()).toBeTruthy();

      s.set_crud_flag(window.beats.CrudFlag.UPDATE)      
      expect(s.crud()).toEqual(window.beats.CrudFlag.CREATE);
    });
  });
  describe("to_xml", function() {
    msg = "should remove crud flags, mod stamp and deleted elements ";
    msg += "and then replace them";
    it(msg, function(){
      s1 = new window.beats.Sensor();
      s1.set_crud(window.beats.CrudFlag.CREATE);
      s2 = new window.beats.Sensor();
      s2.set_crud(window.beats.CrudFlag.DELETE);
      s.set_sensors([s1, s2]);
      s.set_mod_stamp("01/01/01");
      s.set_crud(window.beats.CrudFlag.UPDATE);
      doc = document.implementation.createDocument(null, null, null)
      xml = s.to_xml(doc);
      xmlS = new XMLSerializer().serializeToString(xml)
      expect(xmlS.match(/<sensor>/g).length).toEqual(1);
      expect(xmlS.match(/mod_stamp/g)).toBeNull();
      expect(xmlS.match(/crudFlag/g)).toBeNull();
      expect(s.sensors().length).toEqual(2);
      expect(s.mod_stamp()).toEqual("01/01/01");
      expect(s.crud()).toEqual(window.beats.CrudFlag.UPDATE);
      
      
      window.beats.fileSaveMode = false;
      doc = document.implementation.createDocument(null, null, null)
      xml = s.to_xml(doc);
      xmlS = new XMLSerializer().serializeToString(xml)
      expect(xmlS.match(/<\/sensor>/g).length).toEqual(2);
      expect(xmlS.match(/mod_stamp/g)).not.toBeNull();<commit_msg>Cleaned up SensorSetSpec<commit_after>describe("SensorSet", function() {
  
  beforeEach(function() {
    s = new window.beats.SensorSet();
  });
  
  describe("Default Attributes", function() {
    it("should be set", function() {
      expect(s.name()).toEqual('');  
      expect(s.description_text()).toEqual('');
      expect(s.ident()).toEqual(null);
      expect(s.project_id()).toEqual(null);
      expect(s.sensors().length).toEqual(0);
      expect(s.locked_for_edit()).toBeFalsy();
      expect(s.locked_for_history()).toBeFalsy();
      expect(s.crud()).toEqual(window.beats.CrudFlag.CREATE);
    });
  });
  
  describe("Attributes", function() {
    it("should be set", function() {
      s.set_name('SS test');
      expect(s.name()).toEqual('SS test');
      
      s.set_description_text('SS Desc');
      expect(s.description_text()).toEqual('SS Desc');
      
      s.set_id(12);
      expect(s.ident()).toEqual(12);
      
      s.set_project_id(12);
      expect(s.project_id()).toEqual(12);
      
      s.set_sensors([new window.beats.Sensor()]);
      expect(s.sensors().length).toEqual(1);
      
      s.set_locked_for_edit(true)
      expect(s.locked_for_edit()).toBeTruthy();

      s.set_locked_for_history(true)
      expect(s.locked_for_history()).toBeTruthy();

      s.set_crud_flag(window.beats.CrudFlag.UPDATE)      
      expect(s.crud()).toEqual(window.beats.CrudFlag.CREATE);
    });
  });
  describe("to_xml", function() {
    beforeEach(function() {
      s1 = new window.beats.Sensor();
      s1.set_crud(window.beats.CrudFlag.CREATE);
      s2 = new window.beats.Sensor();
      s2.set_crud(window.beats.CrudFlag.DELETE);
      s.set_sensors([s1, s2]);
      s.set_mod_stamp("01/01/01");
      s.set_crud(window.beats.CrudFlag.UPDATE);
    });
    msg = "should remove crud flags, mod stamp and deleted elements ";
    msg += "and then replace them";
    it(msg, function(){   
      doc = document.implementation.createDocument(null, null, null)
      xml = s.to_xml(doc);
      xmlS = new XMLSerializer().serializeToString(xml)
      expect(xmlS.match(/<sensor>/g).length).toEqual(1);
      expect(xmlS.match(/mod_stamp/g)).toBeNull();
      expect(xmlS.match(/crudFlag/g)).toBeNull();
      expect(s.sensors().length).toEqual(2);
      expect(s.mod_stamp()).toEqual("01/01/01");
      expect(s.crud()).toEqual(window.beats.CrudFlag.UPDATE);
    });
    msg = "should keep all crudFlags, mod_stamps and deleted elements when";
    msg += " saving to db";
    it(msg, function(){
      window.beats.fileSaveMode = false;
      doc = document.implementation.createDocument(null, null, null)
      xml = s.to_xml(doc);
      xmlS = new XMLSerializer().serializeToString(xml)
      expect(xmlS.match(/<\/sensor>/g).length).toEqual(2);
      expect(xmlS.match(/mod_stamp/g)).not.toBeNull();
{'fraction_non_alphanumeric': 0.17739288969917957, 'fraction_numerical': 0.01130355515041021, 'mean_word_length': 3.140377358490566, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 28}, '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': '7316403', 'n_tokens_mistral': 1878, 'n_tokens_neox': 1885, 'n_words': 232}