<commit_before>import { test, moduleForComponent } from 'ember-qunit';
import Ember from 'ember';
moduleForComponent('jobs-item', 'JobsItemComponent', {
  needs: ['helper:format-duration', 'helper:pretty-date', 'component:status-icon']
});

test('it renders', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      jdk: 'openjdk6',
      os: 'linux',
      env: 'TESTS=unit'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  ok(component.$().hasClass('passed'), 'component should have a state class (passed)');
  equal(component.$('.job-number').text().trim(), '2', 'job number should be displayed');
  equal(component.$('.job-lang').text().trim(), 'JDK: openjdk6 Ruby: 2.1.2', 'languages list should be displayed');
  equal(component.$('.job-env').text().trim(), 'TESTS=unit', 'env should be displayed');
  ok(component.$('.job-os').hasClass('linux'), 'OS class should be added for OS icon');
  return equal(component.$('.job-duration').text().trim(), '1 min 40 sec', 'duration should be displayed');
});

test('outputs info on not set properties', function () {
  var component, job;
  job = Ember.Object.create();
  component = this.subject({
    job: job
  });
  this.render();
  ok(component.$('.job-env').text().match(/no environment variables set/), 'a message for no env vars should be displayed');
  return ok(component.$('.job-lang').text().match(/no language set/), 'a message about no language being set should be displayed');
});

test('when env is not set, gemfile is displayed in the env section', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      gemfile: 'foo/Gemfile'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  equal(component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2', 'langauges list should be displayed');
  return equal(component.$('.job-env .label-align').text().trim(), 'Gemfile: foo/Gemfile', 'env should be displayed');
});

test('when env is set, gemfile is displayed in the language section', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      gemfile: 'foo/Gemfile',
      env: 'FOO=bar'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  equal(component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2 Gemfile: foo/Gemfile', 'Gemfile should be displayed in languages section');
  return equal(component.$('.job-env .label-align').text().trim(), 'FOO=bar', 'env should be displayed');
});<commit_msg>Fix typo in component test (#748)<commit_after>import { test, moduleForComponent } from 'ember-qunit';
import Ember from 'ember';
moduleForComponent('jobs-item', 'JobsItemComponent', {
  needs: ['helper:format-duration', 'helper:pretty-date', 'component:status-icon']
});

test('it renders', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      jdk: 'openjdk6',
      os: 'linux',
      env: 'TESTS=unit'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  ok(component.$().hasClass('passed'), 'component should have a state class (passed)');
  equal(component.$('.job-number').text().trim(), '2', 'job number should be displayed');
  equal(component.$('.job-lang').text().trim(), 'JDK: openjdk6 Ruby: 2.1.2', 'languages list should be displayed');
  equal(component.$('.job-env').text().trim(), 'TESTS=unit', 'env should be displayed');
  ok(component.$('.job-os').hasClass('linux'), 'OS class should be added for OS icon');
  return equal(component.$('.job-duration').text().trim(), '1 min 40 sec', 'duration should be displayed');
});

test('outputs info on not set properties', function () {
  var component, job;
  job = Ember.Object.create();
  component = this.subject({
    job: job
  });
  this.render();
  ok(component.$('.job-env').text().match(/no environment variables set/), 'a message for no env vars should be displayed');
  return ok(component.$('.job-lang').text().match(/no language set/), 'a message about no language being set should be displayed');
});

test('when env is not set, gemfile is displayed in the env section', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      gemfile: 'foo/Gemfile'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  equal(component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2', 'languages list should be displayed');
  return equal(component.$('.job-env .label-align').text().trim(), 'Gemfile: foo/Gemfile', 'env should be displayed');
});

test('when env is set, gemfile is displayed in the language section', function () {
  var attributes, component, job;
  attributes = {
    id: 10,
    state: 'passed',
    number: '2',
    config: {
      rvm: '2.1.2',
      gemfile: 'foo/Gemfile',
      env: 'FOO=bar'
    },
    duration: 100
  };
  job = Ember.Object.create(attributes);
  component = this.subject({
    job: job
  });
  this.render();
  equal(component.$('.job-lang .label-align').text().trim(), 'Ruby: 2.1.2 Gemfile: foo/Gemfile', 'Gemfile should be displayed in languages section');
  return equal(component.$('.job-env .label-align').text().trim(), 'FOO=bar', 'env should be displayed');
});
{'fraction_non_alphanumeric': 0.18922135328119688, 'fraction_numerical': 0.014790887453247194, 'mean_word_length': 3.661648177496038, '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': '6257555', 'n_tokens_mistral': 1933, 'n_tokens_neox': 1863, 'n_words': 519}