<commit_before>import { expect } from 'chai'

import substyle from '../src'

describe('chaining', () => {

  it('should return a new substyle that has preconfigured default styles to merge the style prop with', function () {
    const substyleWithDefaultStyles = substyle({
      style: {
        width: 50, 
        nested: { height: 10, width: 10 },
      }
    })
    const props = { style: { height: 50, nested: { width: 20 } } }
    expect({...substyleWithDefaultStyles(props)}).to.deep.equal(
      { style: { height: 50, width: 50 } }
    )
    expect({...substyleWithDefaultStyles(props, 'nested')}).to.deep.equal(
      { style: { height: 10, width: 20 } }
    )
  })

  it('should have a default className which is used if no other className is passed', () => {
    const substyleWithDefaultClassName = substyle({
      className: 'foo'
    })
    expect({...substyleWithDefaultClassName({}, 'bar')}).to.deep.equal({
      className: 'foo__bar'
    })
    expect({...substyleWithDefaultClassName({ className: 'baz' }, 'bar')}).to.deep.equal({
      className: 'baz__bar'
    })
  })

  it('should select the style definitions for all modifiers substyle calls', function () {
    const myStyle = {
      position: 'absolute',
      '&outer': {
        cursor: 'pointer',
      },
      '&inner': {
        color: 'red' 
      }
    }
    const { style } =  substyle({ style: myStyle }, '&outer')('&inner')
    expect(style).to.deep.equal({<commit_msg>fixed the last failing spec<commit_after>import { expect } from 'chai'

import substyle from '../src'

describe('chaining', () => {

  it('should return a new substyle that has preconfigured default styles to merge the style prop with', function () {
    const substyleWithDefaultStyles = substyle({
      style: {
        width: 50, 
        nested: { height: 10, width: 10 },
      }
    })
    const props = { style: { height: 50, nested: { width: 20 } } }
    expect({...substyleWithDefaultStyles(props)}).to.deep.equal(
      { style: { height: 50, width: 50 } }
    )
    expect({...substyleWithDefaultStyles(props, 'nested')}).to.deep.equal(
      { style: { height: 10, width: 20 } }
    )
  })

  it('should have a default className which is used if no other className is passed', () => {
    const substyleWithDefaultClassName = substyle({
      className: 'foo'
    })
    expect({...substyleWithDefaultClassName({}, 'bar')}).to.deep.equal({
      className: 'foo__bar'
    })
    expect({...substyleWithDefaultClassName({ className: 'baz' }, 'bar')}).to.deep.equal({
      className: 'baz__bar'
    })
  })

  it('should select the style definitions for all modifiers substyle calls', function () {
    const myStyle = {
      position: 'absolute',
      '&outer': {
        cursor: 'pointer',
      },
      '&inner': {
        color: 'red' 
      }
    }
    const { style } =  substyle({ style: myStyle }, '&outer')({}, '&inner')
    expect(style).to.deep.equal({
{'fraction_non_alphanumeric': 0.1603131381892444, 'fraction_numerical': 0.012253233492171545, 'mean_word_length': 2.767948717948718, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '624399', 'n_tokens_mistral': 931, 'n_tokens_neox': 890, 'n_words': 234}