<commit_before>import React from 'react'
import { shallow } from 'enzyme'
import DatasetSection from '../DatasetSection'
import datasetMock from '../../../fetch/__test__/dataset.json'
import { doneSince } from '../../../helpers/doneSince'

describe('<DatasetSection />', () => {
  let wrapper

  beforeEach(() => {
    wrapper = shallow(<DatasetSection dataset={datasetMock} />)
  })

  it('should display dataset title', () => {
    expect(wrapper.contains(datasetMock.metadata.title)).toBe(true)
  })

  it('should display dataset description', () => {
    expect(wrapper.contains(datasetMock.metadata.description)).toBe(true)
  })

  it('should display dataset type', () => {
    expect(wrapper.contains(datasetMock.metadata.type)).toBe(true)
  })

  it('should display dataset license', () => {
    expect(wrapper.contains(datasetMock.metadata.license)).toBe(true)
  })

  it('should display dataset revision date', () => {
    expect(wrapper.contains(doneSince(datasetMock.revisionDate))).toBe(true)
  })

  it('should display dataset id', () => {
    expect(wrapper.contains(datasetMock.metadata.id)).toBe(true)
  })

})
<commit_msg>Add test<commit_after>import React from 'react'
import { shallow } from 'enzyme'
import DatasetSection from '../DatasetSection'
import datasetMock from '../../../fetch/__test__/dataset.json'
import { doneSince } from '../../../helpers/doneSince'

describe('<DatasetSection />', () => {

  describe('When all metadata are defined', () => {
    let wrapper
    beforeEach(() => {
      wrapper = shallow(<DatasetSection dataset={datasetMock} />)
    })

    it('should display dataset title', () => {
      expect(wrapper.contains(datasetMock.metadata.title)).toBe(true)
    })

    it('should display dataset description', () => {
      expect(wrapper.contains(datasetMock.metadata.description)).toBe(true)
    })

    it('should display dataset type', () => {
      expect(wrapper.contains(datasetMock.metadata.type)).toBe(true)
    })

    it('should display dataset license', () => {
      expect(wrapper.contains(datasetMock.metadata.license)).toBe(true)
    })

    it('should display dataset revision date', () => {
      expect(wrapper.contains(doneSince(datasetMock.revisionDate))).toBe(true)
    })

    it('should display dataset id', () => {
      expect(wrapper.contains(datasetMock.metadata.id)).toBe(true)
    })
  })

  describe('When metadata are undefined', () => {
    let wrapper
    beforeEach(() => {
      datasetMock.metadata.license = undefined
      datasetMock.metadata.type = undefined
      wrapper = shallow(<DatasetSection dataset={datasetMock} />)
    })

    it('should display dataset type', () => {
      expect(wrapper.contains('unknown')).toBe(true)
    })

    it('should display dataset license', () => {
      expect(wrapper.contains('not determined')).toBe(true)
    })
  })


})

{'fraction_non_alphanumeric': 0.17039888033589923, 'fraction_numerical': 0.0, 'mean_word_length': 3.7334437086092715, 'pattern_counts': {'":': 0, '<': 8, '<?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': '1370568', 'n_tokens_mistral': 800, 'n_tokens_neox': 787, 'n_words': 147}