<commit_before>expect = require('chai').expect
parent = require '../src/parent'
u = require './utils'

describe 'parent', ->

  it 'should return null when there is no parent', ->
    u.inject '''
      <div>
        <span>iron maiden</span>
      </div>
    '''
    expect parent u.one 'span'
      .to.not.exist

  it 'should return parent', ->
    u.inject '''
      <div id="black-sabbath" data-tu>
        <span>iron maiden</span>
      </div>
    '''
    expect parent u.one 'span'
      .to.exist
      .and.to.have.property 'id', 'black-sabbath'

  it 'should return parent', ->
    u.inject '''
      <div id="black-sabbath" data-tu>
        <div>
          <span>iron maiden</span>
        </div>
      </div>
    '''
    expect parent u.one 'span'
      .to.exist
      .and.to.have.property 'id', 'black-sabbath'<commit_msg>Adds test for parent function<commit_after>expect = require('chai').expect
parent = require '../src/parent'
u = require './utils'

describe 'parent', ->

  it 'should return null when there is no parent', ->
    u.inject '''
      <div>
        <span>iron maiden</span>
      </div>
    '''
    expect parent u.one 'span'
      .to.not.exist

  it 'should return parent', ->
    u.inject '''
      <div id="black-sabbath" data-tu>
        <span>iron maiden</span>
      </div>
    '''
    expect parent u.one 'span'
      .to.exist
      .and.to.have.property 'id', 'black-sabbath'

  it 'should return parent of parent', ->
    u.inject '''
      <div id="black-sabbath" data-tu>
        <div>
          <span>iron maiden</span>
        </div>
      </div>
    '''
    expect parent u.one 'span'
      .to.exist
      .and.to.have.property 'id', 'black-sabbath'

  it 'should return immediate parent', ->
    u.inject '''
      <div data-tu>
        <div id="black-sabbath" data-tu>
          <div>
            <span>iron maiden</span>
          </div>
        </div>
      </div>
    '''
    expect parent u.one 'span'
      .to.exist
      .and.to.have.property 'id', 'black-sabbath'
{'fraction_non_alphanumeric': 0.16765578635014836, 'fraction_numerical': 0.0, 'mean_word_length': 1.894134477825465, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 48, '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': '1272709', 'n_tokens_mistral': 693, 'n_tokens_neox': 666, 'n_words': 168}