Chore: Remove search_srv (#62964)

* Chore: Remove Search Service

* use getSortOptions from grafana searcher

* wip

* fix library panels search tests
This commit is contained in:
Josh Hunt
2023-02-07 15:28:07 -05:00
committed by GitHub
parent f80bf11782
commit 09637caade
6 changed files with 22 additions and 506 deletions
@@ -4,7 +4,9 @@ import userEvent from '@testing-library/user-event';
import React from 'react';
import { PanelPluginMeta, PluginType } from '@grafana/data';
import { config } from '@grafana/runtime';
import { Panel } from '@grafana/schema';
import { getGrafanaSearcher } from 'app/features/search/service';
import { backendSrv } from '../../../../core/services/backend_srv';
import * as panelUtils from '../../../panel/state/util';
@@ -63,9 +65,21 @@ async function getTestContext(
module: '',
sort: 1,
};
const getSpy = jest
.spyOn(backendSrv, 'get')
.mockResolvedValue({ sortOptions: [{ displaName: 'Desc', name: 'alpha-desc' }] });
config.featureToggles = { panelTitleSearch: false };
const getSpy = jest.spyOn(backendSrv, 'get');
jest.spyOn(getGrafanaSearcher(), 'getSortOptions').mockResolvedValue([
{
label: 'Alphabetically (AZ)',
value: 'alpha-asc',
},
{
label: 'Alphabetically (ZA)',
value: 'alpha-desc',
},
]);
const getLibraryPanelsSpy = jest.spyOn(api, 'getLibraryPanels').mockResolvedValue(searchResult);
const getAllPanelPluginMetaSpy = jest.spyOn(panelUtils, 'getAllPanelPluginMeta').mockReturnValue([graph, timeseries]);