mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Discover] Fix Background Search Session Management Table fetching sessions data re-fetches data
jest test (#150585)
This commit is contained in:
parent
0fd7d207ff
commit
552c9aa5af
1 changed files with 12 additions and 16 deletions
|
@ -149,18 +149,11 @@ describe('Background Search Session Management Table', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/88928
|
||||
describe.skip('fetching sessions data', () => {
|
||||
describe('fetching sessions data', () => {
|
||||
test('re-fetches data', async () => {
|
||||
jest.useFakeTimers({ legacyFakeTimers: true });
|
||||
sessionsClient.find = jest.fn();
|
||||
mockConfig = {
|
||||
...mockConfig,
|
||||
management: {
|
||||
...mockConfig.management,
|
||||
refreshInterval: moment.duration(10, 'seconds'),
|
||||
},
|
||||
};
|
||||
jest.useFakeTimers();
|
||||
const find = jest.fn();
|
||||
sessionsClient.find = find;
|
||||
|
||||
await act(async () => {
|
||||
mount(
|
||||
|
@ -175,12 +168,15 @@ describe('Background Search Session Management Table', () => {
|
|||
/>
|
||||
</LocaleWrapper>
|
||||
);
|
||||
jest.advanceTimersByTime(20000);
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
// 1 for initial load + 1 refresh calls
|
||||
expect(find).toHaveBeenCalledTimes(2);
|
||||
},
|
||||
{ timeout: 3000, interval: 500 }
|
||||
);
|
||||
});
|
||||
|
||||
// 1 for initial load + 2 refresh calls
|
||||
expect(sessionsClient.find).toBeCalledTimes(3);
|
||||
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue