<commit_before>require 'test_helper'

class DevServerTest < MiniTest::Unit::TestCase
  include Rack::Test::Methods

  def app
    Iridium::DevServer.new.app
  end

  def setup
    Iridium.application = TestApp.instance
  end

  def test_it_should_serve_the_root
    get '/'

    assert last_response.ok?
  end

  def test_returns_not_found
    get '/foo/bars.js'

    assert_equal 404, last_response.status
  end
end<commit_msg>Add tests for dev server pipeline<commit_after>require 'test_helper'

class DevServerTest < MiniTest::Unit::TestCase
  include Rack::Test::Methods

  def app
    Iridium::DevServer.new.app
  end

  def setup
    @created_files = []
    Iridium.application = TestApp.instance
  end

  def teardown
    FileUtils.rm_rf TestApp.root.join("app")
    FileUtils.rm_rf TestApp.root.join("site")
    FileUtils.rm_rf TestApp.root.join("tmp")

    @created_files.each do |path|
      FileUtils.rm_rf path
    end
  end

  def test_it_should_serve_the_root
    get '/'

    assert last_response.ok?
  end

  def test_returns_not_found
    get '/foo/bars.js'

    assert_equal 404, last_response.status
  end

  def test_pipeline
    create_file "javascripts/foo.js", "bar"

    get '/application.js'

    assert last_response.ok?

    assert_includes last_response.body, "bar"
  end

  private
  def create_file(path, content)
    full_path = TestApp.root.join "app", path

    @created_files << full_path

    FileUtils.mkdir_p File.dirname(full_path)

    File.open full_path, "w" do |f|
      f.puts content
    end
  end
end
{'fraction_non_alphanumeric': 0.08802588996763754, 'fraction_numerical': 0.003883495145631068, 'mean_word_length': 3.2589531680440773, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5182020', 'n_tokens_mistral': 552, 'n_tokens_neox': 523, 'n_words': 116}