<commit_before>require 'res/ir'
require 'json'

EXAMPLE_FILE = 'spec/outputs/junit.res'

describe Res::IR do

  context "Loading in IR files" do
    describe ".load" do
      it 'loads in a cucumber IR results file' do
        Res::IR.load( EXAMPLE_FILE )
      end
    end
  end

  context "Handling cucumber IR generated by Hive-Results gem" do
    
    let(:ir) { Res::IR.load( EXAMPLE_FILE ) }

    describe "#tests" do

      it 'returns an array of just the test portions of the json' do
        expect(ir.tests).to be_a Array
        expect(ir.tests.count).to eq 7
      end

      it 'only includes Testcase as tests' do
        node_types = ir.tests.collect { |t| t[:type] }.uniq!
        expect(node_types).to eq [ 'testcase' ]
      end
      
    end

    describe "#count" do
      it "Can pick out the passing tests from the run" do
        expect(ir.count(:passed)).to eq 6
      end

      it "Can pick out the failing tests from the run" do
        expect(ir.count(:failed)).to eq 1
      end

      it "Can identify there were no tests of an unknown type" do
        expect(ir.count(:unknown)).to eq 0
      end
    end
  end

end<commit_msg>Added Junit::type in spec<commit_after>require 'res/ir'
require 'json'

EXAMPLE_FILE = 'spec/outputs/junit.res'

describe Res::IR do

  context "Loading in IR files" do
    describe ".load" do
      it 'loads in a cucumber IR results file' do
        Res::IR.load( EXAMPLE_FILE )
      end
    end
  end

  context "Handling cucumber IR generated by Hive-Results gem" do
    
    let(:ir) { Res::IR.load( EXAMPLE_FILE ) }

    describe "#tests" do

      it 'returns an array of just the test portions of the json' do
        expect(ir.tests).to be_a Array
        expect(ir.tests.count).to eq 7
      end

      it 'only includes Testcase as tests' do
        node_types = ir.tests.collect { |t| t[:type] }.uniq!
        expect(node_types).to eq [ 'JUnit::testcase' ]
      end
      
    end

    describe "#count" do
      it "Can pick out the passing tests from the run" do
        expect(ir.count(:passed)).to eq 6
      end

      it "Can pick out the failing tests from the run" do
        expect(ir.count(:failed)).to eq 1
      end

      it "Can identify there were no tests of an unknown type" do
        expect(ir.count(:unknown)).to eq 0
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.09234715690466011, 'fraction_numerical': 0.003420265070542967, 'mean_word_length': 2.2142857142857144, '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': '772199', 'n_tokens_mistral': 762, 'n_tokens_neox': 725, 'n_words': 274}