<commit_before>import React from 'react';
import chai, { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import d3Shape from 'd3-shape';

import { Symbol } from '../';

chai.use(chaiEnzyme());

describe('<Symbol />', () => {
  it('renders any shape that is supported by d3Shape.symbol', () => {
    const assertion = (type) => {
      const wrapper = shallow(<Symbol symbolType={type} />);
      expect(wrapper).to.have.exactly(1).descendants('path');
      expect(wrapper.find('path'))
        .to.have.attr('d')
        .that.is.a('string');
    };

    ['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye'].forEach(assertion);
  });

  it('renders a circle when given a type that is not supported by d3Shape.symbol', () => {
    const wrapper = shallow(<Symbol symbolType={'unicorn'} />);
    expect(wrapper).to.have.exactly(1).descendants('path');
    expect(wrapper.find('path'))
      .to.have.attr('d')
      .that.is.a('string')
      .that.equals(d3Shape.symbol().type(d3Shape.symbolCircle)());
  });

  it('applies a rotate modifier', () => {
    const wrapper = shallow(<Symbol symbolType="triangle down" />);
    expect(wrapper.find('path'))
      .to.have.attr('transform')
      .that.equals('translate(0, 0) rotate(180)');
  });

  describe('styling', () => {
    const datum = {
      mean: 10,
    };

    const baseStyle = {<commit_msg>test that symbol will not apply a transform rotation if not given a modifier<commit_after>import React from 'react';
import chai, { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import d3Shape from 'd3-shape';

import { Symbol } from '../';

chai.use(chaiEnzyme());

describe('<Symbol />', () => {
  it('renders any shape that is supported by d3Shape.symbol', () => {
    const assertion = (type) => {
      const wrapper = shallow(<Symbol symbolType={type} />);
      expect(wrapper).to.have.exactly(1).descendants('path');
      expect(wrapper.find('path'))
        .to.have.attr('d')
        .that.is.a('string');
    };

    ['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye'].forEach(assertion);
  });

  it('renders a circle when given a type that is not supported by d3Shape.symbol', () => {
    const wrapper = shallow(<Symbol symbolType="unicorn" />);
    expect(wrapper).to.have.exactly(1).descendants('path');
    expect(wrapper.find('path'))
      .to.have.attr('d')
      .that.is.a('string')
      .that.equals(d3Shape.symbol().type(d3Shape.symbolCircle)());
  });

  it('applies a rotate modifier when appropriate', () => {
    const wrapper = shallow(<Symbol symbolType="triangle down" />);
    expect(wrapper.find('path'))
      .to.have.attr('transform')
      .that.equals('translate(0, 0) rotate(180)');
  });

  it('does not apply a rotate modifier when appropriate', () => {
    const wrapper = shallow(<Symbol symbolType="triangle" />);
    expect(wrapper.find('path'))
      .to.have.attr('transform')
      .that.equals('translate(0, 0) rotate(0)');
  });

  describe('styling', () => {
    const datum = {
      mean: 10,
    };

    const baseStyle = {
{'fraction_non_alphanumeric': 0.19121768919339768, 'fraction_numerical': 0.010277172220492058, 'mean_word_length': 3.5049088359046285, 'pattern_counts': {'":': 0, '<': 12, '<?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': '2469402', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1009, 'n_words': 230}