<commit_before>/**
 * Specs for the Heatmap component.
 */
'use strict';
import React from 'react';
import {mount, shallow} from 'enzyme';
import Heatmap from './Heatmap';
import {expect} from 'chai';

const CUSTOM_DATA = Object.freeze({
  z: [[0, 10], [3, 4]],
  x: ['Build Artifact', null],
  y: ['UI', 'Titan'],
  hoverinfo: 'text',
  type: 'heatmap',
  colorscale: []
});

const init = (heatmapData) => {
  const props = {
    heatmapData
  };
  return shallow(<Heatmap {...props} />)
};

describe('heatmap component', () => {
  it('should render a single PlotlyComponent', () => {
    const wrapper = init(CUSTOM_DATA);
    // Find by display name.
    expect(wrapper.find('Plotly')).to.have.length(1);
  });

  describe('added metadata', () => {
    let data;
    beforeEach(() => {
      const wrapper = init(CUSTOM_DATA);
      const props = wrapper.find('Plotly').props();
      console.log(props)
      data = props.data[0];
    });

    it('should have type "heatmap"', () => {
      expect(data.type).to.equal('heatmap');
    });

    it('should have "hoverinfo" type "text"', () => {
      expect(data.hoverinfo).to.equal('text');
    });

    it('should convert null values into "Unknown"', () => {
      expect(data.x).to.not.contain(null);
      expect(data.x).to.contain('Unknown');
    });

    it('should build correct "hoverinfo" text value', () => {
      const expected = [[
        "Stage: Build Artifact<br>Application: UI<br>Failures: 0",
        "Stage: Unknown<br>Application: UI<br>Failures: 10"
      ], [
        "Stage: Build Artifact<br>Application: Titan<br>Failures: 3",
        "Stage: Unknown<br>Application: Titan<br>Failures: 4"
      ]];
      expect(data.text).to.deep.equal(expected);
    })
  });

});
<commit_msg>Update tests/linter issues<commit_after>/**
 * Specs for the Heatmap component.
 */
'use strict';
import React from 'react';
import {mount, shallow} from 'enzyme';
import Heatmap from './Heatmap';
import {expect} from 'chai';

const CUSTOM_DATA = Object.freeze({
  z: [[0, 10], [3, 4]],
  x: ['Build Artifact', null],
  y: ['UI', 'Titan'],
  hoverinfo: 'text',
  type: 'heatmap',
  colorscale: []
});

const init = (heatmapData) => {
  const props = {
    heatmapData
  };
  return shallow(<Heatmap {...props} />);
};

describe('heatmap component', () => {
  it('should render a single PlotlyComponent', () => {
    const wrapper = init(CUSTOM_DATA);
    // Find by display name.
    expect(wrapper.find('Plotly')).to.have.length(1);
  });

  describe('added metadata', () => {
    let data;
    beforeEach(() => {
      const wrapper = init(CUSTOM_DATA);
      const props = wrapper.find('Plotly').props();
      data = props.data[0];
    });

    it('should have type "heatmap"', () => {
      expect(data.type).to.equal('heatmap');
    });

    it('should have "hoverinfo" type "text"', () => {
      expect(data.hoverinfo).to.equal('text');
    });

    it('should convert null values into "Unknown"', () => {
      expect(data.x).to.not.contain(null);
      expect(data.x).to.contain('Unknown');
    });

    it('should build correct "hoverinfo" text value', () => {
      const expected = [[
        "Stage: Build Artifact<br>Application: UI<br>Failures: 0",
        "Stage: Unknown<br>Application: UI<br>Failures: 10"
      ], [
        "Stage: Build Artifact<br>Application: Titan<br>Failures: 3",
        "Stage: Unknown<br>Application: Titan<br>Failures: 4"
      ]];
      expect(data.text).to.deep.equal(expected);
    });
  });

});

{'fraction_non_alphanumeric': 0.19360365505425473, 'fraction_numerical': 0.006853226727584237, 'mean_word_length': 3.170238095238095, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 39, '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': '6870022', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1153, 'n_words': 259}