<commit_before>import React from 'react';
import T from 'prop-types';
import _ from 'lodash';
// import ReactTooltip from 'react-tooltip';

const categories = [
  {
    id: 'Core',
    parameters: [],
  },
  {
    id: 'Additional',
    info:
      'The following pollutants are less common than the core parameters. You may have to broaden other search filters when using these parameters to find sufficient results',
    parameters: [],
  },
];

function ParamSelect(props) {
  const { parameters, onFilterSelect, selected } = props;
  return (
    <ul
      role="menu"
      data-cy="filter-parameters"
      className="drop__menu drop__menu--select scrollable padded"
    >
      {_.chain(parameters)
        .uniq('id')
        .reduce(([core, additional], param) => {
          if (param.isCore) {
            core.parameters.push(param);
          } else {
            additional.parameters.push(param);
          }
          return [core, additional];
        }, categories)
        .map(({ id, /* info,*/ parameters: list }) => {
          return (
            <React.Fragment key={id}>
              <p
                className="drop__menu-section-title"
                data-tip
                data-for={`${id}-info`}
              >
                {id}
              </p>

              {/*info && (
                <ReactTooltip id={`${id}-info`} place="bottom" effect="float">
                  {info}
                </ReactTooltip>
              )*/}

              {_.sortBy(list).map(param => {
                return (
                  <label
                    className="form__option form__option--custom-checkbox"
                    htmlFor={param.id}
                    key={param.id}
                  >
                    <input
                      type="checkbox"
                      value={param.displayName}
                      id={param.id}
                      name="form-checkbox"
                      onChange={() => {
                        onFilterSelect('parameters', param.id);
                      }}
                      checked={selected.parameters.includes(param.id)}
                    />
                    <span className="form__option__text">
                      {param.displayName}
                    </span>
                    <span className="form__option__ui"></span>
                  </label>
                );
              })}
            </React.Fragment>
          );
        })
        .value()}
    </ul>
  );
}
ParamSelect.propTypes = {
  parameters: T.array,
  onFilterSelect: T.func,
  selected: T.object,
};
export default ParamSelect;
<commit_msg>Fix test<commit_after>import React from 'react';
import T from 'prop-types';
import _ from 'lodash';
// import ReactTooltip from 'react-tooltip';

const categories = [
  {
    id: 'Core',
    parameters: [],
  },
  {
    id: 'Additional',
    info:
      'The following pollutants are less common than the core parameters. You may have to broaden other search filters when using these parameters to find sufficient results',
    parameters: [],
  },
];

/*
 * Select parameters from a list using checkboxes,
 * assumes Core and Additional as categories
 */
function ParamSelect(props) {
  const { parameters, onFilterSelect, selected } = props;
  return (
    <ul
      role="menu"
      data-cy="filter-parameters"
      className="drop__menu drop__menu--select scrollable padded"
    >
      {_.chain(parameters)
        .uniq('id')
        .reduce(([core, additional], param) => {
          if (param.isCore) {
            core.parameters.push(param);
          } else {
            additional.parameters.push(param);
          }
          return [core, additional];
        }, categories)
        .map(({ id, /* info,*/ parameters: list }) => {
          return (
            <React.Fragment key={id}>
              <p
                className="drop__menu-section-title"
                data-tip
                data-for={`${id}-info`}
              >
                {id}
              </p>

              {/*info && (
                <ReactTooltip id={`${id}-info`} place="bottom" effect="float">
                  {info}
                </ReactTooltip>
              )*/}

              {_.sortBy(list).map(param => {
                return (
                  <label
                    className="form__option form__option--custom-checkbox"
                    htmlFor={param.id}
                    key={param.id}
                      data-cy='filter-menu-item'
                    data-hook='dropdown:close'

                  >
                    <input
                      type="checkbox"
                      value={param.displayName}
                      id={param.id}
                      name="form-checkbox"
                      onChange={() => {
                        onFilterSelect('parameters', param.id);
                      }}
                    data-cy={param.id}

                      checked={selected.parameters.includes(param.id)}
                    />
                    <span className="form__option__text">
                      {param.displayName}
                    </span>
                    <span className="form__option__ui"></span>
                  </label>
                );
              })}
            </React.Fragment>
          );
        })
        .value()}
    </ul>
  );
}
ParamSelect.propTypes = {
  parameters: T.array,
  onFilterSelect: T.func,
  selected: T.object,
};
export default ParamSelect;

{'fraction_non_alphanumeric': 0.12229692894784663, 'fraction_numerical': 0.0, 'mean_word_length': 1.3077568134171909, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 41, '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': '2363896', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1372, 'n_words': 289}