<commit_before>require_relative 'minitest_helper'
require "pathname"
require "tmpdir"

module Blogstats
  class EndToEndTest < Minitest::Test
    def setup
      @dir = Pathname.new(Dir.tmpdir)
      create_sample_files(dir)
    end

    def teardown
      dir.rmtree
    end

    def test_end_to_end
      expected_output = <<-EOF
Posts: 2
Words: 20
      EOF
      assert_output(expected_output, "") do
        CLI.run([dir])
      end
    end

    private

    attr_reader :dir

    def create_sample_files(dir)
      (dir / "post1.md").write(post1_content)
      (dir / "post2.md").write(post2_content)
    end

    def post1_content
      <<-EOF
---
layout: post
title: Post 1
---
This is some basic post test.

Here's another paragraph.
      EOF
    end

    def post2_content
      <<-EOF
---
layout: post
title: Post 2
---
This is another post.

It has another paragraph.

And then another.
      EOF
    end
  end
end<commit_msg>Temporarily remove YAML front-matter from end-to-end test<commit_after>require_relative 'minitest_helper'
require "pathname"
require "tmpdir"

module Blogstats
  class EndToEndTest < Minitest::Test
    def setup
      @dir = Pathname.new(Dir.tmpdir)
      create_sample_files(dir)
    end

    def teardown
      dir.rmtree
    end

    def test_end_to_end
      expected_output = <<-EOF
Posts: 2
Words: 20
      EOF
      assert_output(expected_output, "") do
        CLI.run([dir])
      end
    end

    private

    attr_reader :dir

    def create_sample_files(dir)
      (dir / "post1.md").write(post1_content)
      (dir / "post2.md").write(post2_content)
    end

#     def post1_content
#       <<-EOF
# ---
# layout: post
# title: Post 1
# ---
# This is some basic post test.
#
# Here's another paragraph.
#       EOF
#     end
#
#     def post2_content
#       <<-EOF
# ---
# layout: post
# title: Post 2
# ---
# This is another post.
#
# It has another paragraph.
#
# And then another.
#       EOF
#     end

    def post1_content
      <<-EOF
This is some basic post test.

Here's another paragraph.
      EOF
    end

    def post2_content
      <<-EOF
This is another post.

It has another paragraph.

And then another.
      EOF
    end
  end
end
{'fraction_non_alphanumeric': 0.0963198546115402, 'fraction_numerical': 0.010904134484325307, 'mean_word_length': 2.2430044182621502, 'pattern_counts': {'":': 0, '<': 21, '<?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': '5796590', 'n_tokens_mistral': 780, 'n_tokens_neox': 738, 'n_words': 209}