<commit_before>require 'test_helper'

class AncestryTest < MiniTest::Test
  def test_it_renders_single_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'single_parent')
      test_file = read_test_file('parents', 'single_parent')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_two_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'two_parents')
      test_file = read_test_file('parents', 'two_parents')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_array_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'array_parents')
      test_file = read_test_file('parents', 'array_parents')
      assert_equal output_file, test_file
    end
  end

  def test_missing_category_title_does_not_blow_up_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'missing_title')
      test_file = read_test_file('parents', 'missing_title')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_hash_children
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('children', 'hash_children')
      test_file = read_test_file('children', 'hash_children')
      assert_equal output_file, test_file

      output_file = read_output_file('children', 'later_hash_children')
      test_file = read_test_file('children', 'later_hash_children')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_array_children
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('children', 'array_children')
      test_file = read_test_file('children', 'array_children')
      assert_equal output_file, test_file
    end
  end
end
<commit_msg>Test that articles without children should show an empty array of children.<commit_after>require 'test_helper'

class AncestryTest < MiniTest::Test
  def test_it_renders_single_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'single_parent')
      test_file = read_test_file('parents', 'single_parent')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_two_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'two_parents')
      test_file = read_test_file('parents', 'two_parents')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_array_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'array_parents')
      test_file = read_test_file('parents', 'array_parents')
      assert_equal output_file, test_file
    end
  end

  def test_missing_category_title_does_not_blow_up_parents
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('parents', 'missing_title')
      test_file = read_test_file('parents', 'missing_title')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_content_with_no_children
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('children', 'no_children')
      test_file = read_test_file('children', 'no_children')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_hash_children
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('children', 'hash_children')
      test_file = read_test_file('children', 'hash_children')
      assert_equal output_file, test_file

      output_file = read_output_file('children', 'later_hash_children')
      test_file = read_test_file('children', 'later_hash_children')
      assert_equal output_file, test_file
    end
  end

  def test_it_renders_array_children
    with_site(name: FIXTURES_DIR) do |site|

      site = Nanoc::Int::SiteLoader.new.new_from_cwd
      site.compile

      output_file = read_output_file('children', 'array_children')
      test_file = read_test_file('children', 'array_children')
      assert_equal output_file, test_file
    end
  end
end

{'fraction_non_alphanumeric': 0.08739595719381689, 'fraction_numerical': 0.0, 'mean_word_length': 3.997029702970297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1963884', 'n_tokens_mistral': 1723, 'n_tokens_neox': 1649, 'n_words': 301}