{"size": 881, "ext": "js", "max_stars_repo_path": "app/assets/javascripts/helpers/Filters.test.js", "max_stars_repo_name": "ciscomeneses/studentinsights", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/assets/javascripts/helpers/Filters.test.js", "max_issues_repo_name": "ciscomeneses/studentinsights", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/assets/javascripts/helpers/Filters.test.js", "max_forks_repo_name": "ciscomeneses/studentinsights", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.4642857143, "max_line_length": 79, "alphanum_fraction": 0.6379114642}
import * as Filters from './Filters';

const helpers = {
  students() {
    return [
     { active_services: [{ service_type_id: 504 }] },
     { active_services: [{ service_type_id: 503 }, { service_type_id: 501 }] },
     { active_services: [{ service_type_id: 504 }] },
     { active_services: [] }
    ];
  }
};

describe('#ServiceType', () => {
  it('filters for a value', () => {
    const filter = Filters.ServiceType(504);
    expect(filter.key).toEqual('service_type');
    expect(filter.identifier).toEqual('service_type:504');
    expect(helpers.students().filter(filter.filterFn).length).toEqual(2);
  });

  it('filters null', () => {
    const filter = Filters.ServiceType(null);
    expect(filter.key).toEqual('service_type');
    expect(filter.identifier).toEqual('service_type:');
    expect(helpers.students().filter(filter.filterFn).length).toEqual(1);
  });
});