<commit_before><commit_msg>added tests for UnevenSets example<commit_after>import React from 'react'
import { mount } from 'enzyme'
import UnevenSetsFinite from '../UnevenSetsFinite'
import UnevenSetsInfinite from '../UnevenSetsInfinite'
import { html as beautify_html } from 'js-beautify'
import { clickNext } from '../../__tests__/testUtils'

describe('UnevenSets Finite', () => {
  test('Counting test', () => {
    const slider = mount(<UnevenSetsFinite />)
    let totalSlides = slider.find('.slick-slide').length
    let clonedSlides = slider.find('.slick-cloned').length
    let activeSlides = slider.find('.slick-slide.slick-active').length
    let dots = slider.find('.slick-dots').children().length
    expect(totalSlides).toEqual(6)
    expect(clonedSlides).toEqual(0)
    expect(activeSlides).toEqual(4)
    expect(dots).toEqual(2)
  })
  test('Positioning test', () => {
    const slider = mount(<UnevenSetsFinite />)
    let currentSlide = slider.find('div.slick-current')
    let activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(0)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([0, 1, 2, 3])
  })
  test('Activity test', () => {
    const slider = mount(<UnevenSetsFinite />)
    let currentSlide = slider.find('div.slick-current')
    let activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(0)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([0, 1, 2, 3])

    clickNext(slider)

    currentSlide = slider.find('div.slick-current')
    activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(4)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([4, 5])

    clickNext(slider)

    currentSlide = slider.find('div.slick-current')
    activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(4)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([4, 5])

  })
})

describe('UnevenSets Infinite', () => {
  test('Counting test', () => {
    const slider = mount(<UnevenSetsInfinite />)
    let totalSlides = slider.find('.slick-slide').length
    let clonedSlides = slider.find('.slick-cloned').length
    let activeSlides = slider.find('.slick-slide.slick-active').length
    let dots = slider.find('.slick-dots').children().length
    expect(totalSlides).toEqual(16)
    expect(clonedSlides).toEqual(10)
    expect(activeSlides).toEqual(4)
    expect(dots).toEqual(2)
  })
  test('Positioning test', () => {
    const slider = mount(<UnevenSetsInfinite />)
    let currentSlide = slider.find('div.slick-current')
    let activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(0)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([0, 1, 2, 3])
  })
  test('Activity test', () => {
    const slider = mount(<UnevenSetsInfinite />)
    let currentSlide = slider.find('div.slick-current')
    let activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(0)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([0, 1, 2, 3])

    clickNext(slider)

    currentSlide = slider.find('div.slick-current')
    activeSlides = slider.find('div.slick-active')
    expect(currentSlide.props()['data-index']).toEqual(4)
    expect(activeSlides.map(slide => slide.props()['data-index'])).toEqual([4, 5, 6, 7])
  })
})
{'fraction_non_alphanumeric': 0.18289251547552055, 'fraction_numerical': 0.011536297129994372, 'mean_word_length': 4.435779816513762, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 24, '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': '4025314', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1193, 'n_words': 173}