<commit_before>'use strict'
describe('Piston', function () {
  let Piston = require('../lib/Piston');
  let currentPiston;
  let specPath;

  beforeEach(function () {
    specPath = '../pistonSpecs/airbnb.json';
    currentPiston = new Piston(specPath);
  });

  describe('can use a json file', function () {
    it('Throws an error if file path is invalid', function () {
      specPath = '';
      expect(function () {new Piston(specPath);}).toThrow();
    });

    it('Throws an error if file extension is not json', function () {
      specPath = __dirname + '/dummys/airbnb.piston';
      expect(function () {new Piston(specPath);}).toThrow();
    });

    it('Returns a valid object', function () {
      specPath = '../pistonSpecs/airbnb.json';
      expect(new Piston(specPath)).toEqual(jasmine.any(Object));
    });
  });

  describe('can create action from keys', function () {
    it('correctly creates properties from a action object', function () {
      let functionName = 'getUser';
      expect(currentPiston[functionName]).toEqual(jasmine.any(Function));
    });
  });
});<commit_msg>Added tests for new feature of parsing YAML files with Piston<commit_after>'use strict';
describe('Piston', function () {
  let Piston = require('../lib/Piston');
  let currentPiston;
  let specPath;

  describe('can create a valid specObject', function () {
    
    it('from a json file', function(){
      specPath = '../pistonSpecs/airbnb.json';
      expect(new Piston(specPath)).toEqual(jasmine.any(Object));
    });

    it('from a yaml file', function(){
      specPath = './pistonSpecs/spotify.yml';
      expect(new Piston(specPath)).toEqual(jasmine.any(Object));
    });

    it('or it throws an error if file path is invalid', function () {
      specPath = '';
      expect(function () {new Piston(specPath);}).toThrow();
    });

    it('or throws an error if file extension is not valid', function () {
      specPath = __dirname + '/dummys/airbnb.piston';
      expect(function () {new Piston(specPath);}).toThrow();
    });
  });

  describe('can create action from keys', function () {
    it('correctly creates properties from a action object', function () {
      let functionName = 'getUser';
      specPath = '../pistonSpecs/airbnb.json';
      currentPiston = new Piston(specPath);
      expect(currentPiston[functionName]).toEqual(jasmine.any(Function));
    });
  });
});
{'fraction_non_alphanumeric': 0.15978306216103463, 'fraction_numerical': 0.0, 'mean_word_length': 3.4080882352941178, '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': '7105869', 'n_tokens_mistral': 757, 'n_tokens_neox': 711, 'n_words': 179}