<commit_before>describe('pivot', function () {
  var sample_csv;

  beforeEach(function () {
      sample_csv = "last_name,first_name,zip_code\n" +
                   "Jackson,Robert,34471\n" +
                   "Smith,Jon,34471\n" +
                   "Jackson,Jon,34474\n" +
                   "Jackson,Susan,34476\n" +
                   "Fornea,Chris,34474\n" +
                   "Fornea,Shelly,39401"

      pivot.fields().set([
        {name: 'last_name',  type: 'string',  filterable: true},
        {name: 'first_name', type: 'string',  filterable: true},
        {name: 'zip_code',   type: 'integer', filterable: true}
      ]);

      pivot.csv(sample_csv);
    });

  afterEach(function () {
    pivot.reset();
  });

  describe('CSV', function () {
    it('can parse csv into an array', function(){
      expect(pivot.data().raw[0]).toEqual({last_name:'Jackson',first_name:'Robert',zip_code: 34471});
      expect(pivot.data().raw.length).toEqual(6)
    });

    it('can filter items from csv', function() {
      expect(pivot.data().raw.length).toEqual(6);

      // apply filter
      pivot.filters().apply({last_name: 'Jackson'});
      expect(pivot.data().all.length).toEqual(3);
    });
  });

  describe('Filters', function() {
    beforeEach(function () {
      pivot.filters().set({last_name: 'Jackson'});<commit_msg>Add test to reveal error in adding a new filter (it doesn't cast type).<commit_after>describe('pivot', function () {
  var sample_csv;

  beforeEach(function () {
      sample_csv = "last_name,first_name,zip_code\n" +
                   "Jackson,Robert,34471\n" +
                   "Smith,Jon,34471\n" +
                   "Jackson,Jon,34474\n" +
                   "Jackson,Susan,34476\n" +
                   "Fornea,Chris,34474\n" +
                   "Fornea,Shelly,39401"

      pivot.fields().set([
        {name: 'last_name',  type: 'string',  filterable: true},
        {name: 'first_name', type: 'string',  filterable: true},
        {name: 'zip_code',   type: 'integer', filterable: true}
      ]);

      pivot.csv(sample_csv);
    });

  afterEach(function () {
    pivot.reset();
  });

  describe('CSV', function () {
    it('can parse csv into an array', function(){
      expect(pivot.data().raw[0]).toEqual({last_name:'Jackson',first_name:'Robert',zip_code: 34471});
      expect(pivot.data().raw.length).toEqual(6)
    });

    it('can filter items from csv', function() {
      expect(pivot.data().raw.length).toEqual(6);

      // apply filter
      pivot.filters().apply({last_name: 'Jackson'});
      expect(pivot.data().all.length).toEqual(3);
    });
  });

  describe('Filters', function() {
    beforeEach(function () {
      pivot.filters().set({last_name: 'Jackson'});
    });

    it('force type specifity on new filters', function(){
      pivot.filters().add({zip_code: '34471'})
      expect(pivot.filters().all.zip_code).toEqual(34471)
{'fraction_non_alphanumeric': 0.17709766162310867, 'fraction_numerical': 0.030261348005502064, 'mean_word_length': 2.586929716399507, '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': '728283', 'n_tokens_mistral': 1043, 'n_tokens_neox': 937, 'n_words': 150}