{"size": 1589, "ext": "js", "max_stars_repo_path": "kolibri/plugins/learn/assets/src/composables/__mocks__/useSearch.js", "max_stars_repo_name": "MBKayro/kolibri", "max_stars_repo_stars_event_min_datetime": "2016-01-19T19:26:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T00:13:04.000Z", "max_issues_repo_path": "kolibri/plugins/learn/assets/src/composables/__mocks__/useSearch.js", "max_issues_repo_name": "MBKayro/kolibri", "max_issues_repo_issues_event_min_datetime": "2016-01-19T19:32:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:23:12.000Z", "max_forks_repo_path": "kolibri/plugins/learn/assets/src/composables/__mocks__/useSearch.js", "max_forks_repo_name": "MBKayro/kolibri", "max_forks_repo_forks_event_min_datetime": "2016-01-19T19:26:48.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T14:35:05.000Z"}
{"max_stars_count": 545, "max_issues_count": 8329, "max_forks_count": 493, "avg_line_length": 24.0757575758, "max_line_length": 68, "alphanum_fraction": 0.6456891126}
/**
 * `useSearch` composable function mock.
 *
 * If default values are sufficient for tests,
 * you only need call `jest.mock('<useSearch file path>')`
 * at the top of a test file.
 *
 * If you need to override some default values from some tests,
 * you can import a helper function `useSearchMock` that accepts
 * an object with values to be overriden and use it together
 * with  `mockImplementation` as follows:
 *
 * ```
 * // eslint-disable-next-line import/named
 * import useSearch, { useSearchMock } from '<useSearch file path>';
 *
 * jest.mock('<useSearch file path>')
 *
 * it('test', () => {
 *   useSearch.mockImplementation(
 *     () => useSearchMock({ classes: [{ id: 'class-1' }] })
 *   );
 * })
 * ```
 *
 * You can reset your mock implementation back to default values
 * for other tests by calling the following in `beforeEach`:
 *
 * ```
 * useSearch.mockImplementation(() => useSearchMock())
 * ```
 */

const MOCK_DEFAULTS = {
  searchTerms: {
    learning_activities: {},
    categories: {},
    learner_needs: {},
    channels: {},
    accessibility_labels: {},
    languages: {},
    grade_levels: {},
  },
  displayingSearchResults: false,
  searchLoading: false,
  moreLoading: false,
  results: [],
  more: null,
  labels: null,
  search: jest.fn(),
  searchMore: jest.fn(),
  removeFilterTag: jest.fn(),
  clearSearch: jest.fn(),
  setCategory: jest.fn(),
  setSearchWithinDescendant: jest.fn(),
};

export function useSearchMock(overrides = {}) {
  return {
    ...MOCK_DEFAULTS,
    ...overrides,
  };
}

export default jest.fn(() => useSearchMock());
