mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `9.0`: - [[Synthetics] Unskip jest test (#214411)](https://github.com/elastic/kibana/pull/214411) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Justin Kambic","email":"jk@elastic.co"},"sourceCommit":{"committedDate":"2025-03-14T18:52:42Z","message":"[Synthetics] Unskip jest test (#214411)\n\n## Summary\n\nResolves #204152.\n\nUnskips a test.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d39d4fc5c58a193c3ed81ff6aed36f8c72b52316","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","Team:obs-ux-management","v9.1.0"],"title":"[Synthetics] Unskip jest test","number":214411,"url":"https://github.com/elastic/kibana/pull/214411","mergeCommit":{"message":"[Synthetics] Unskip jest test (#214411)\n\n## Summary\n\nResolves #204152.\n\nUnskips a test.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d39d4fc5c58a193c3ed81ff6aed36f8c72b52316"}},"sourceBranch":"main","suggestedTargetBranches":["9.0"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214411","number":214411,"mergeCommit":{"message":"[Synthetics] Unskip jest test (#214411)\n\n## Summary\n\nResolves #204152.\n\nUnskips a test.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d39d4fc5c58a193c3ed81ff6aed36f8c72b52316"}}]}] BACKPORT--> Co-authored-by: Justin Kambic <jk@elastic.co>
This commit is contained in:
parent
a3ded6e9c8
commit
f61f65f88f
2 changed files with 3 additions and 37 deletions
|
@ -6,19 +6,17 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { renderHook, act } from '@testing-library/react';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import * as reactRedux from 'react-redux';
|
||||
import { useBins, useMonitorStatusData } from './use_monitor_status_data';
|
||||
import { WrappedHelper } from '../../../utils/testing';
|
||||
import * as selectedMonitorHook from '../hooks/use_selected_monitor';
|
||||
import * as selectedLocationHook from '../hooks/use_selected_location';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
const Wrapper = ({ children }: React.PropsWithChildren) =>
|
||||
React.createElement(WrappedHelper, null, children);
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/204152
|
||||
describe.skip('useMonitorStatusData', () => {
|
||||
describe('useMonitorStatusData', () => {
|
||||
let dispatchMock: jest.Mock;
|
||||
beforeEach(() => {
|
||||
dispatchMock = jest.fn();
|
||||
|
@ -78,38 +76,6 @@ describe.skip('useMonitorStatusData', () => {
|
|||
dispatchMock.mock.calls.some((args) => args[0].type === 'QUIET GET MONITOR STATUS HEATMAP')
|
||||
).not.toBe(true);
|
||||
});
|
||||
|
||||
it('handles resize events and requests based on new data', async () => {
|
||||
const props = {
|
||||
from: 1728310613654,
|
||||
to: 1728317313654,
|
||||
initialSizeRef: { current: { clientWidth: 0 } as any },
|
||||
};
|
||||
const { result } = renderHook(() => useMonitorStatusData(props), {
|
||||
wrapper: Wrapper,
|
||||
});
|
||||
await act(async () => {
|
||||
result.current.handleResize({ width: 250, height: 800 });
|
||||
// this is necessary for debounce to complete
|
||||
await new Promise((r) => setTimeout(r, 510));
|
||||
});
|
||||
const fetchActions = dispatchMock.mock.calls.filter(
|
||||
(args) => args[0].type === 'QUIET GET MONITOR STATUS HEATMAP'
|
||||
);
|
||||
expect(fetchActions).toHaveLength(1);
|
||||
expect(omit(fetchActions[0][0], 'meta')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"payload": Object {
|
||||
"from": 1728310613654,
|
||||
"interval": 7,
|
||||
"location": "us-east-1",
|
||||
"monitorId": "testMonitorId",
|
||||
"to": 1728317313654,
|
||||
},
|
||||
"type": "QUIET GET MONITOR STATUS HEATMAP",
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('useBins', () => {
|
||||
|
|
|
@ -93,7 +93,7 @@ export const useMonitorStatusData = ({ from, to, initialSizeRef }: Props) => {
|
|||
);
|
||||
|
||||
useDebounce(
|
||||
async () => {
|
||||
() => {
|
||||
setDebouncedCount(binsAvailableByWidth === 0 ? null : binsAvailableByWidth);
|
||||
},
|
||||
500,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue