From 0106e2e5baad4e1be5cc64c18cdc8802977c434e Mon Sep 17 00:00:00 2001 From: Eyo Okon Eyo Date: Thu, 21 Nov 2024 13:36:42 +0100 Subject: [PATCH] [React18] Migrated test suites to accommodate changes to testing library owned by obs-ai-assistant,security-solution --- .../data_usage/public/hooks/use_get_data_streams.test.tsx | 2 +- .../data_usage/public/hooks/use_get_usage_metrics.test.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/data_usage/public/hooks/use_get_data_streams.test.tsx b/x-pack/plugins/data_usage/public/hooks/use_get_data_streams.test.tsx index 04cee589a523d..6c5d2c06a075a 100644 --- a/x-pack/plugins/data_usage/public/hooks/use_get_data_streams.test.tsx +++ b/x-pack/plugins/data_usage/public/hooks/use_get_data_streams.test.tsx @@ -7,7 +7,7 @@ import React, { ReactNode } from 'react'; import { QueryClient, QueryClientProvider, useQuery as _useQuery } from '@tanstack/react-query'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useGetDataUsageDataStreams } from './use_get_data_streams'; import { DATA_USAGE_DATA_STREAMS_API_ROUTE } from '../../common'; import { coreMock as mockCore } from '@kbn/core/public/mocks'; diff --git a/x-pack/plugins/data_usage/public/hooks/use_get_usage_metrics.test.tsx b/x-pack/plugins/data_usage/public/hooks/use_get_usage_metrics.test.tsx index 677bd4bdfcef1..ead97859dd34b 100644 --- a/x-pack/plugins/data_usage/public/hooks/use_get_usage_metrics.test.tsx +++ b/x-pack/plugins/data_usage/public/hooks/use_get_usage_metrics.test.tsx @@ -5,10 +5,9 @@ * 2.0. */ -import moment from 'moment'; import React, { ReactNode } from 'react'; import { QueryClient, QueryClientProvider, useQuery as _useQuery } from '@tanstack/react-query'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useGetDataUsageMetrics } from './use_get_usage_metrics'; import { DATA_USAGE_METRICS_API_ROUTE } from '../../common'; import { coreMock as mockCore } from '@kbn/core/public/mocks'; @@ -42,8 +41,8 @@ jest.mock('../utils/use_kibana', () => { }); const defaultUsageMetricsRequestBody = { - from: moment().subtract(15, 'minutes').toISOString(), - to: moment().toISOString(), + from: 'now-15m', + to: 'now', metricTypes: ['ingest_rate'], dataStreams: ['ds-1'], };