<commit_before>require "spec_helper"

describe AwesomeTranslations::ErbInspector::FileInspector do
  let(:erb_inspector) do
    AwesomeTranslations::ErbInspector.new(
      dirs: [Rails.root.to_s]
    )
  end

  let(:files) { erb_inspector.files.to_a }
  let(:file_paths) { files.map(&:file_path) }
  let(:user_index_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/index.html.haml" } }
  let(:user_edit_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/edit.html.liquid" } }
  let(:user_index_translations) { user_index_inspector.translations.to_a }
  let(:hello_world_translation) { user_index_translations.find { |translation| translation.key == ".hello_world" } }

  describe "#translations" do
    it "finds the right number of translations" do
      expect(user_index_translations.length).to eq 3
    end

    it "finds liquid translations" do
      translation_keys = user_edit_inspector.translations.map(&:key)

      puts "TranslationKeys: #{translation_keys}"

      expect(translation_keys).to include ".edit_user"
      expect(translation_keys).to include ".test_for_liquid_templates"
      expect(translation_keys).to include ".test_for_liquid_templates_with_var_double_quotes"<commit_msg>Removed debug output<commit_after>require "spec_helper"

describe AwesomeTranslations::ErbInspector::FileInspector do
  let(:erb_inspector) do
    AwesomeTranslations::ErbInspector.new(
      dirs: [Rails.root.to_s]
    )
  end

  let(:files) { erb_inspector.files.to_a }
  let(:file_paths) { files.map(&:file_path) }
  let(:user_index_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/index.html.haml" } }
  let(:user_edit_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/edit.html.liquid" } }
  let(:user_index_translations) { user_index_inspector.translations.to_a }
  let(:hello_world_translation) { user_index_translations.find { |translation| translation.key == ".hello_world" } }

  describe "#translations" do
    it "finds the right number of translations" do
      expect(user_index_translations.length).to eq 3
    end

    it "finds liquid translations" do
      translation_keys = user_edit_inspector.translations.map(&:key)

      expect(translation_keys).to include ".edit_user"
      expect(translation_keys).to include ".test_for_liquid_templates"
      expect(translation_keys).to include ".test_for_liquid_templates_with_var_double_quotes"
{'fraction_non_alphanumeric': 0.11217183770883055, 'fraction_numerical': 0.0007955449482895784, 'mean_word_length': 5.119221411192214, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3304723', 'n_tokens_mistral': 871, 'n_tokens_neox': 820, 'n_words': 130}