<commit_before># frozen_string_literal: true

require 'spec_helper'

describe HowIs::Analyzer do
  let(:issues) { JSON.parse(open(File.expand_path('../data/issues.json', __dir__)).read) }
  let(:pulls) { JSON.parse(open(File.expand_path('../data/pulls.json', __dir__)).read) }

  let(:fake_issues) { JSON.parse(open(File.expand_path('../data/fake/issues.json', __dir__)).read) }
  #let(:fake_pulls) { JSON.parse(open(File.expand_path('../data/pulls.json', __dir__)).read) }

  let(:fetcher_results) { HowIs::Fetcher::Results.new(issues, pulls) }

  subject { HowIs::Analyzer.new }

  context '#num_with_label' do
    it 'returns a Hash mapping labels to the number of issues or pulls with that label' do
      actual   = subject.num_with_label(fake_issues)
      expected = {"triage" => 3, "administrative" => 2}

      expect(actual).to eq(expected)
    end
  end

  context '#average_date_for' do<commit_msg>[analyzer_spec] add space after # in commented-out code so RuboCop is happy<commit_after># frozen_string_literal: true

require 'spec_helper'

describe HowIs::Analyzer do
  let(:issues) { JSON.parse(open(File.expand_path('../data/issues.json', __dir__)).read) }
  let(:pulls) { JSON.parse(open(File.expand_path('../data/pulls.json', __dir__)).read) }

  let(:fake_issues) { JSON.parse(open(File.expand_path('../data/fake/issues.json', __dir__)).read) }
  # let(:fake_pulls) { JSON.parse(open(File.expand_path('../data/pulls.json', __dir__)).read) }

  let(:fetcher_results) { HowIs::Fetcher::Results.new(issues, pulls) }

  subject { HowIs::Analyzer.new }

  context '#num_with_label' do
    it 'returns a Hash mapping labels to the number of issues or pulls with that label' do
      actual   = subject.num_with_label(fake_issues)
      expected = {"triage" => 3, "administrative" => 2}

      expect(actual).to eq(expected)
    end
  end

  context '#average_date_for' do
{'fraction_non_alphanumeric': 0.1571959638874137, 'fraction_numerical': 0.002124269782262347, 'mean_word_length': 4.476744186046512, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6932540', 'n_tokens_mistral': 657, 'n_tokens_neox': 637, 'n_words': 127}