mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
e7971fa08e
commit
c2e464325e
1 changed files with 28 additions and 0 deletions
|
@ -96,6 +96,34 @@ describe('Async search strategy', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// For bug fixed in https://github.com/elastic/kibana/pull/64155
|
||||
it('Continues polling if no records are returned on first async request', async () => {
|
||||
mockSearch
|
||||
.mockReturnValueOnce(of({ id: 1, total: 0, loaded: 0, is_running: true, is_partial: true }))
|
||||
.mockReturnValueOnce(
|
||||
of({ id: 1, total: 2, loaded: 2, is_running: false, is_partial: false })
|
||||
);
|
||||
|
||||
const asyncSearch = asyncSearchStrategyProvider({
|
||||
core: mockCoreStart,
|
||||
getSearchStrategy: jest.fn().mockImplementation(() => {
|
||||
return () => {
|
||||
return {
|
||||
search: mockSearch,
|
||||
};
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
expect(mockSearch).toBeCalledTimes(0);
|
||||
|
||||
await asyncSearch.search(mockRequest, mockOptions).toPromise();
|
||||
|
||||
expect(mockSearch).toBeCalledTimes(2);
|
||||
expect(mockSearch.mock.calls[0][0]).toEqual(mockRequest);
|
||||
expect(mockSearch.mock.calls[1][0]).toEqual({ id: 1, serverStrategy: 'foo' });
|
||||
});
|
||||
|
||||
it('only sends the ID and server strategy after the first request', async () => {
|
||||
mockSearch
|
||||
.mockReturnValueOnce(of({ id: 1, total: 2, loaded: 1, is_running: true, is_partial: true }))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue