<commit_before><commit_msg>Added virtualized tableRow unit tests.<commit_after>import * as React from 'react';
import { shallow } from 'enzyme';
import { TableRowComponent } from '../tableRow';

describe('TableRowComponent tests', () => {
  it('should return a div with passed "className", "key" and "style"', () => {
    // Arrange
    const props = {
      className: 'rowClassName',
      columns: [],
      index: 0,
      key: 0,
      isScrolling: false,
      style: { color: 'red' },
      rowKey: 5,
    };

    // Act
    const tableRowComponent = shallow(
      <TableRowComponent {...props} />,
    );

    // Assert
    expect(tableRowComponent.prop('className')).to.be.equals('rowClassName');
    expect(tableRowComponent.prop('style')).to.be.deep.equals({ color: 'red' });
  });

  it('should have as many child component as passed', () => {
    // Arrange
    const props = {
      className: 'rowClassName',
      columns: [
        { props: { className: 'column1' } },
        { props: { className: 'column2' } },
        { props: { className: 'column3' } },
      ],
      index: 0,
      key: 0,
      isScrolling: false,
      style: {},
      rowKey: 0,
    };

    // Act
    const tableRowComponent = shallow(
      <TableRowComponent {...props}>
        <span>Span 1</span>
        <span>Span 2</span>
        <span>Span 3</span>
      </TableRowComponent>,
    );

    // Assert
    expect(tableRowComponent.children().length).to.be.equals(3);
  });

  it('should wrap each child with a div with "style" and "className" from "columns" object', () => {
    // Arrange
    const props = {
      className: '',
      columns: [
        { props: { className: 'column0', style: { color: '#000' } } },
        { props: { className: 'column1', style: { color: '#001' } } },
        { props: { className: 'column2', style: { color: '#002' } } },
      ],
      index: 0,
      key: 0,
      isScrolling: false,
      style: {},
      rowKey: 5,
    };

    // Act
    const tableRowComponent = shallow(
      <TableRowComponent {...props}>
        <span>Span 1</span>
        <span>Span 2</span>
        <span>Span 3</span>
      </TableRowComponent>,
    );

    // Assert
    tableRowComponent.children().forEach((child, index) => {
      const divWrapper = child.at(0);
      expect(child.key()).to.be.equals(String(index));
      expect(child.prop('className')).to.be.equals(`column${index}`);
      expect(child.prop('style')).to.be.deep.equals({ color: `#00${index}` });
      expect(divWrapper.type()).to.be.equals('div');
      expect(divWrapper.childAt(0).type()).to.be.equals('span');
      expect(divWrapper.childAt(0).text()).to.be.equals(`Span ${index + 1}`);
    });
  });
});
{'fraction_non_alphanumeric': 0.18353028064992616, 'fraction_numerical': 0.013663220088626292, 'mean_word_length': 2.4421855146124525, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 25, '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': '7141400', 'n_tokens_mistral': 868, 'n_tokens_neox': 841, 'n_words': 179}