<commit_before>describeComponent('component/data/issues_exporter', function () {
  beforeEach(function () {
    this.setupComponent();
  });

  it('creates a csv link and adds new issues to the end of it', function(){
    var issues = [
      {
        "projectName": "pixelated-platform",
        "number":   "90",
        "title":    "sending mails",
        "state":   "open",
        "labels": [{name: "1- Backlog"}, {name: "2- Dev"}],
        "kanbanState":   "1 - Ready",
        "body":     "should send email",
        "created_at": "2014-11-18T13:29:41Z",
        "closed_at": "2014-11-19T13:28:41Z",
        "dev_at": "2014-11-18T14:00:41Z",
        "qa_at": "2014-11-10T10:00:41Z"
      },
      {
        "projectName": "pixelated-user-agent",
        "number":   "92",
        "title":    "handle errors on sending mails",
        "state":   "open",
        "labels": [{name: "3- QA"}, {name: "2- Dev"}],
        "kanbanState":   "0 - Backlog",
        "body":     "If mails can't be sent by the twisted process",
        "created_at": "2014-11-18T13:29:41Z",
        "closed_at": "2014-11-19T13:29:41Z",
        "dev_at": "2014-11-18T14:00:41Z",
        "qa_at": "2014-11-19T11:00:41Z"
      }
    ];

    var contentToEncode = "Source;Github ID;Title;Status;Kanban State;Tags;Create at;Dev at;QA at;Closed at;Lead Time;Cycle Time" +
        "\n\"pixelated-platform\";90;\"sending mails\";open;1 - Ready;\"1- Backlog,2- Dev\";2014-11-18T13:29:41Z;2014-11-18T14:00:41Z;2014-11-19T13:28:41Z;2014-11-10T10:00:41Z;0;0" +
        "\n\"pixelated-user-agent\";92;\"handle errors on sending mails\";open;0 - Backlog;\"3- QA,2- Dev\";2014-11-18T13:29:41Z;2014-11-18T14:00:41Z;2014-11-19T13:29:41Z;2014-11-19T11:00:41Z;1;0\n";

    expect(this.component.linkToCsv(issues)).toEqual("data:text/csv;charset=utf8," + encodeURIComponent(contentToEncode));

    var newIssues = [{
        "projectName": "test-issues-ramon",
        "number":   "66",
        "labels": [],
        "title":    "handle errors on sending mails",
        "state":   "open",
        "kanbanState":   "1 - Backlog",
        "body":     "just testing an issue"
    }];

    var newIssuesToEncode = "\"test-issues-ramon\";66;\"handle errors on sending mails\";open;1 - Backlog;\"\";;;;;\n";

    expect(this.component.linkToCsv(newIssues)).toEqual("data:text/csv;charset=utf8," + encodeURIComponent(contentToEncode + newIssuesToEncode));
  });

  it('should map all the events to the given issues', function() {
    var events = [
      {
        id: 197865882,
        event: "labeled",
        issue: {
          id: 49941279
        }
      },
      {
        id: 197865883,
        event: "labeled",
        issue: {
          id: 49941279
        }
      },
      {
        id: 197865884,
        event: "labeled",
        issue: {<commit_msg>Fix the test data on the csv test<commit_after>describeComponent('component/data/issues_exporter', function () {
  beforeEach(function () {
    this.setupComponent();
  });

  it('creates a csv link and adds new issues to the end of it', function(){
    var issues = [
      {
        "projectName": "pixelated-platform",
        "number":   "90",
        "title":    "sending mails",
        "state":   "open",
        "labels": [{name: "1- Backlog"}, {name: "2- Dev"}],
        "kanbanState":   "1 - Ready",
        "body":     "should send email",
        "created_at": "2014-11-18T13:29:41Z",
        "closed_at": "2014-11-19T13:28:41Z",
        "dev_at": "2014-11-18T14:00:41Z",
        "qa_at": "2014-11-10T10:00:41Z"
      },
      {
        "projectName": "pixelated-user-agent",
        "number":   "92",
        "title":    "handle errors on sending mails",
        "state":   "open",
        "labels": [{name: "3- QA"}, {name: "2- Dev"}],
        "kanbanState":   "0 - Backlog",
        "body":     "If mails can't be sent by the twisted process",
        "created_at": "2014-11-18T13:29:41Z",
        "closed_at": "2014-11-19T13:29:41Z",
        "dev_at": "2014-11-18T14:00:41Z",
        "qa_at": "2014-11-19T11:00:41Z"
      }
    ];

    var contentToEncode = "Source;Github ID;Title;Status;Kanban State;Tags;Create at;Dev at;QA at;Closed at;Lead Time;Cycle Time" +
        "\n\"pixelated-platform\";90;\"sending mails\";open;1 - Ready;\"1- Backlog,2- Dev\";2014-11-18T13:29:41Z;2014-11-18T14:00:41Z;2014-11-10T10:00:41Z;2014-11-19T13:28:41Z;0;0" +
        "\n\"pixelated-user-agent\";92;\"handle errors on sending mails\";open;0 - Backlog;\"3- QA,2- Dev\";2014-11-18T13:29:41Z;2014-11-18T14:00:41Z;2014-11-19T11:00:41Z;2014-11-19T13:29:41Z;1;0\n";

    expect(this.component.linkToCsv(issues)).toEqual("data:text/csv;charset=utf8," + encodeURIComponent(contentToEncode));

    var newIssues = [{
        "projectName": "test-issues-ramon",
        "number":   "66",
        "labels": [],
        "title":    "handle errors on sending mails",
        "state":   "open",
        "kanbanState":   "1 - Backlog",
        "body":     "just testing an issue"
    }];

    var newIssuesToEncode = "\"test-issues-ramon\";66;\"handle errors on sending mails\";open;1 - Backlog;\"\";;;;;;\n";

    expect(this.component.linkToCsv(newIssues)).toEqual("data:text/csv;charset=utf8," + encodeURIComponent(contentToEncode + newIssuesToEncode));
  });

  it('should map all the events to the given issues', function() {
    var events = [
      {
        id: 197865882,
        event: "labeled",
        issue: {
          id: 49941279
        }
      },
      {
        id: 197865883,
        event: "labeled",
        issue: {
          id: 49941279
        }
      },
      {
        id: 197865884,
        event: "labeled",
        issue: {
{'fraction_non_alphanumeric': 0.18164165931156223, 'fraction_numerical': 0.1055604589585172, 'mean_word_length': 2.44228432563791, 'pattern_counts': {'":': 58, '<': 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': '6606937', 'n_tokens_mistral': 2419, 'n_tokens_neox': 2052, 'n_words': 371}