<commit_before>/* eslint-env jest */
import React from 'react'
import { shallow } from 'enzyme'
import { mountWithIntl } from '../../../../test/helpers/intl-enzyme-test-helper.js'
import { EmptySegment } from '../EmptySegment'
import { TILE_SIZE } from '../../segments/constants'
import { SETTINGS_UNITS_METRIC, SETTINGS_UNITS_IMPERIAL } from '../../users/constants'

describe('EmptySegment', () => {
  it('renders nothing when the width is 0', () => {
    const wrapper = shallow(<EmptySegment width={0} />)
    expect(wrapper.html()).toEqual(null)
  })

  it('renders a width, and at left position 0 by default', () => {
    const wrapper = shallow(<EmptySegment width={12.5} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('div').props().style.width).toEqual(`${12.5 * TILE_SIZE}px`)
    expect(wrapper.find('div').props().style.left).toEqual('0px')
  })

  it('renders at width and left position given', () => {
    const wrapper = shallow(<EmptySegment width={15} left={33} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('div').props().style.width).toEqual(`${15 * TILE_SIZE}px`)
    expect(wrapper.find('div').props().style.left).toEqual(`${33 * TILE_SIZE}px`)
  })

  it('renders correct grid styling in metric', () => {
    const wrapper = shallow(<EmptySegment width={1} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('.units-metric').length).toEqual(1)
  })

  it('renders correct grid styling in imperial', () => {
    const wrapper = shallow(<EmptySegment width={1} units={SETTINGS_UNITS_IMPERIAL} locale="en" />)
    expect(wrapper.find('.units-imperial').length).toEqual(1)
  })

  it('renders text content', () => {
    const wrapper = mountWithIntl(<EmptySegment width={15} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.text()).toEqual('Empty space4.5  m')
  })
})<commit_msg>EmptySegment [test]: really fix it now<commit_after>/* eslint-env jest */
import React from 'react'
import { shallow } from 'enzyme'
import { mountWithIntl } from '../../../../test/helpers/intl-enzyme-test-helper.js'
import { EmptySegment } from '../EmptySegment'
import { TILE_SIZE } from '../../segments/constants'
import { SETTINGS_UNITS_METRIC, SETTINGS_UNITS_IMPERIAL } from '../../users/constants'

describe('EmptySegment', () => {
  it('renders nothing when the width is 0', () => {
    const wrapper = shallow(<EmptySegment width={0} />)
    expect(wrapper.html()).toEqual(null)
  })

  it('renders a width, and at left position 0 by default', () => {
    const wrapper = shallow(<EmptySegment width={12.5} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('div').props().style.width).toEqual(`${12.5 * TILE_SIZE}px`)
    expect(wrapper.find('div').props().style.left).toEqual('0px')
  })

  it('renders at width and left position given', () => {
    const wrapper = shallow(<EmptySegment width={15} left={33} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('div').props().style.width).toEqual(`${15 * TILE_SIZE}px`)
    expect(wrapper.find('div').props().style.left).toEqual(`${33 * TILE_SIZE}px`)
  })

  it('renders correct grid styling in metric', () => {
    const wrapper = shallow(<EmptySegment width={1} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.find('.units-metric').length).toEqual(1)
  })

  it('renders correct grid styling in imperial', () => {
    const wrapper = shallow(<EmptySegment width={1} units={SETTINGS_UNITS_IMPERIAL} locale="en" />)
    expect(wrapper.find('.units-imperial').length).toEqual(1)
  })

  it('renders text content', () => {
    const wrapper = mountWithIntl(<EmptySegment width={15} units={SETTINGS_UNITS_METRIC} locale="en" />)
    expect(wrapper.text()).toEqual('Empty space4.5 m')
  })
})
{'fraction_non_alphanumeric': 0.19011105235325224, 'fraction_numerical': 0.013749338974087784, 'mean_word_length': 4.571428571428571, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, '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': '4550961', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1228, 'n_words': 237}