<commit_before>describe('farmbuild.soilSampleImporter module: paddockSoilSampleRetriever', function () {




  //access test data under data dir
  beforeEach(function () {
    fixture.setBase('examples/data')
  });


  //define soil sample result converter
  var $log, paddockSoilSampleRetriever,
    fileFarmDataWithSoilSamples = 'farmdata-susan-with-sample.json';

  // inject farmbuild.soilSampleImporter module
  beforeEach(module('farmbuild.soilSampleImporter', function($provide) {
    $provide.value('$log', console)
  }));

  // inject soilSampleImporter service
  beforeEach(inject(function (_$log_, _paddockSoilSampleRetriever_) {
    $log = _$log_,
      paddockSoilSampleRetriever = _paddockSoilSampleRetriever_;
  }));

  describe('paddockSoilSampleRetriever factory', function () {

    it('paddockSoilSampleRetriever factory should be defined', inject(function () {
      expect(paddockSoilSampleRetriever).toBeDefined();
    }));


    it('paddockSoilSampleRetriever farmdata has soilSamplesInPaddock', inject(function () {
      var loadedFarmData = fixture.load(fileFarmDataWithSoilSamples);
      expect(loadedFarmData).toBeDefined();
      var paddockSoilSamples = paddockSoilSampleRetriever.soilSamplesInPaddock(loadedFarmData,"P1");
      expect(paddockSoilSamples).toBeDefined();
      $log.info('paddockSoilSamples qqq'+JSON.stringify(paddockSoilSamples,null,"  "));
      expect(paddockSoilSamples.length).toBeGreaterThan(0);
      $log.info(paddockSoilSamples[0]);

      var soils= loadedFarmData.soils;
      var sampleResults=soils.sampleResults;
      var importFields =sampleResults.importFieldNames;


      var averages = paddockSoilSampleRetriever.averagesForSoilSamples(importFields,paddockSoilSamples);


      for(var j=0;j<importFields.length;j++){

        var fieldValue = averages[importFields[j]];
        $log.info('fieldValue[j] '+fieldValue +" [importFieldNames[j] "+importFields[j]);
      }

      var pbiAverage = averages['PBI'];
      $log.info('pbiAverage '+pbiAverage);
      expect((pbiAverage==12)).toBeTruthy();

    }));


//    it('paddockSoilSampleRetriever farmdata has soilSamplesInPaddock', inject(function () {
//      var loadedFarmData = fixture.load(fileFarmDataWithSoilSamples);
//      expect(loadedFarmData).toBeDefined();
//      var averagesForPaddockName = paddockSoilSampleRetriever.averagesForPaddock(loadedFarmData,"P3");
//      expect(averagesForPaddockName).toBeDefined();
//
//    }));

  });


});<commit_msg>Test changes<commit_after>describe('farmbuild.soilSampleImporter module: paddockSoilSampleRetriever', function () {




  //access test data under data dir
  beforeEach(function () {
    fixture.setBase('examples/data')
  });


  //define soil sample result converter
  var $log, paddockSoilSampleRetriever,
    fileFarmDataWithSoilSamples = 'farmdata-susan-with-sample.json';

  // inject farmbuild.soilSampleImporter module
  beforeEach(module('farmbuild.soilSampleImporter', function($provide) {
    $provide.value('$log', console)
  }));

  // inject soilSampleImporter service
  beforeEach(inject(function (_$log_, _paddockSoilSampleRetriever_) {
    $log = _$log_,
      paddockSoilSampleRetriever = _paddockSoilSampleRetriever_;
  }));

  describe('paddockSoilSampleRetriever factory', function () {

    it('paddockSoilSampleRetriever factory should be defined', inject(function () {
      expect(paddockSoilSampleRetriever).toBeDefined();
    }));


    it('paddockSoilSampleRetriever farmdata has soilSamplesInPaddock', inject(function () {
      var loadedFarmData = fixture.load(fileFarmDataWithSoilSamples);
      expect(loadedFarmData).toBeDefined();
      var paddockSoilSamples = paddockSoilSampleRetriever.soilSamplesInPaddock(loadedFarmData,"P1");
      expect(paddockSoilSamples).toBeDefined();
      $log.info('paddockSoilSamples qqq'+JSON.stringify(paddockSoilSamples,null,"  "));
      expect(paddockSoilSamples.length).toBeGreaterThan(0);
      $log.info(paddockSoilSamples[0]);

      var soils= loadedFarmData.soils;
      var sampleResults=soils.sampleResults;
      var importFields =sampleResults.importFieldNames;


      var averages = paddockSoilSampleRetriever.averagesForSoilSamples(importFields,paddockSoilSamples);


      for(var j=0;j<importFields.length;j++){

        var fieldValue = averages[importFields[j]];
        $log.info('fieldValue[j] '+fieldValue +" [importFieldNames[j] "+importFields[j]);
      }

      var pbiAverage = averages['PBI'];
      $log.info('pbiAverage '+pbiAverage);
      expect((pbiAverage==12)).toBeTruthy();

    }));


    it('paddockSoilSampleRetriever farmdata has soilSamplesInPaddock', inject(function () {
      var loadedFarmData = fixture.load(fileFarmDataWithSoilSamples);
      expect(loadedFarmData).toBeDefined();
      var averagesForPaddockName = paddockSoilSampleRetriever.averagesForPaddock(loadedFarmData,"P3");
      expect(averagesForPaddockName).toBeDefined();

    }));

  });


});
{'fraction_non_alphanumeric': 0.12094335819391251, 'fraction_numerical': 0.0028220116911912923, 'mean_word_length': 4.769767441860465, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2634619', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1560, 'n_words': 211}