<commit_before>var cgr = require("__buttercup/classes/commands/command.cgr.js");

module.exports = {
  setUp: function(cb) {
    this.command = new cgr();
    (cb)();
  },

  errors: {
    parentGroupIdNotFound: function(test) {
      var fakeSearching = {
        findGroupByID: function(a, b) {
          return false;
        }
      };

      var parentId = 1;

      test.throws(function() {
        this.command.execute({ }, parentId, 0);
      }.bind(this), 'Invalid parent group ID: not found', 'An error was thrown when no group found');
      test.done();
    }
  },

  withoutParentId: {
    oneInObjectGroupsWhenZeroInitially: function(test) {
      var expectedLength = 1;

      var fakeObj = {
        groups: []
      };

      this.command.execute(fakeObj, 0, 1);

      test.strictEqual(fakeObj.groups.length, expectedLength, '1 in object groups when no parent and zero initially');
      test.done();
    },

    twoInObjectGroupsWhenOneInitially: function(test) {
      var expectedLength = 2;

      var fakeObj = {
        groups: [{
          id: 1,
          title: 'bla'
        }]
      };

      this.command.execute(fakeObj, 0, 1);

      test.strictEqual(fakeObj.groups.length, expectedLength, '2 in object groups when no parent and one initially');
      test.done();
    }
  }
};<commit_msg>Test new group id for cgr tests<commit_after>var cgr = require("__buttercup/classes/commands/command.cgr.js");

module.exports = {
  setUp: function(cb) {
    this.command = new cgr();
    (cb)();
  },

  errors: {
    parentGroupIdNotFound: function(test) {
      var fakeSearching = {
        findGroupByID: function(a, b) {
          return false;
        }
      };

      var parentId = 1;

      test.throws(function() {
        this.command.execute({ }, parentId, 0);
      }.bind(this), 'Invalid parent group ID: not found', 'An error was thrown when no group found');
      test.done();
    }
  },

  withoutParentId: {
    oneInObjectGroupsWhenZeroInitially: function(test) {
      var expectedLength = 1;

      var fakeObj = {
        groups: []
      };

      this.command.execute(fakeObj, 0, 1);

      test.strictEqual(fakeObj.groups.length, expectedLength, '1 in object groups when no parent and zero initially');
      test.done();
    },

    twoInObjectGroupsWhenOneInitially: function(test) {
      var expectedLength = 2;

      var fakeObj = {
        groups: [{
          id: 1,
          title: 'bla'
        }]
      };

      this.command.execute(fakeObj, 0, 1);

      test.strictEqual(fakeObj.groups.length, expectedLength, '2 in object groups when no parent and one initially');
      test.done();
    },

    correctIdWhenGroupAddedWithIdOne: function(test) {
      var expectedId = 1;

      var fakeObj = {
        groups: []
      };

      this.command.execute(fakeObj, 0, expectedId);

      test.strictEqual(fakeObj.groups[0].id, expectedId, 'New group has correct id when added with id ' + expectedId);
      test.done();
    },

    correctIdWhenGroupAddedWithIdFifty: function(test) {
      var expectedId = 50;

      var fakeObj = {
        groups: []
      };

      this.command.execute(fakeObj, 0, expectedId);

      test.strictEqual(fakeObj.groups[0].id, expectedId, 'New group has correct id when added with id ' + expectedId);
      test.done();
    }
  }
};
{'fraction_non_alphanumeric': 0.1249624511865425, 'fraction_numerical': 0.00871132472213878, 'mean_word_length': 2.360242179616549, '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': '5419244', 'n_tokens_mistral': 1059, 'n_tokens_neox': 998, 'n_words': 246}