Skip to content

Commit

Permalink
Remove legacy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Aug 20, 2021
1 parent 35096bf commit e160be3
Showing 1 changed file with 1 addition and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import { of } from 'rxjs';
import { IndexPattern } from '../../index_patterns';
import { GetConfigFn } from '../../types';
import { SearchSource, SearchSourceDependencies, SortDirection } from './';
import { AggConfigs, AggTypesRegistryStart, ES_SEARCH_STRATEGY } from '../../';
import { AggConfigs, AggTypesRegistryStart } from '../../';
import { mockAggTypesRegistry } from '../aggs/test_helpers';
import { RequestResponder } from 'src/plugins/inspector/common';
import { switchMap } from 'rxjs/operators';
Expand Down Expand Up @@ -953,45 +952,6 @@ describe('SearchSource', () => {
});

describe('fetch$', () => {
describe('#legacy COURIER_BATCH_SEARCHES', () => {
beforeEach(() => {
searchSourceDependencies = {
...searchSourceDependencies,
getConfig: jest.fn(() => {
return true; // batchSearches = true
}) as GetConfigFn,
};
});

test('should override to use sync search if not set', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = {};
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe(ES_SEARCH_STRATEGY);
});

test('should remove searchSessionId when forcing ES_SEARCH_STRATEGY', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = { sessionId: 'test' };
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe(ES_SEARCH_STRATEGY);
expect(callOptions.sessionId).toBeUndefined();
});

test('should not override strategy if set ', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = { strategy: 'banana' };
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe('banana');
});
});

describe('responses', () => {
test('should return partial results', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
Expand Down

0 comments on commit e160be3

Please sign in to comment.