-
{React.cloneElement(children, childProps)}
+
{React.cloneElement(children, children.type !== React.Fragment ? childProps : undefined)}
{invalid && error && !horizontal && (
{
it('should pass validation checks for email field', async () => {
render();
- fireEvent.click(screen.getByRole('button', { name: 'Send reset email' }));
+ await userEvent.click(screen.getByRole('button', { name: 'Send reset email' }));
expect(await screen.findByText('Email or username is required')).toBeInTheDocument();
await userEvent.type(screen.getByRole('textbox', { name: /User Enter your information/i }), 'test@gmail.com');
@@ -49,7 +49,7 @@ describe('VerifyEmail Page', () => {
render();
await userEvent.type(screen.getByRole('textbox', { name: /User Enter your information/i }), 'test@gmail.com');
- fireEvent.click(screen.getByRole('button', { name: 'Send reset email' }));
+ await userEvent.click(screen.getByRole('button', { name: 'Send reset email' }));
await waitFor(() =>
expect(postMock).toHaveBeenCalledWith('/api/user/password/send-reset-email', {
userOrEmail: 'test@gmail.com',
diff --git a/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.test.tsx b/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.test.tsx
index 0d8636c98bc..c12a2ac6264 100644
--- a/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.test.tsx
+++ b/public/app/features/alerting/unified/components/rule-viewer/RuleViewer.test.tsx
@@ -479,7 +479,7 @@ describe('RuleViewer', () => {
expect.objectContaining({
ruleUid: 'test-rule-uid',
}),
- expect.any(Object)
+ undefined
);
expect(screen.getByTestId('enrichment-section')).toBeInTheDocument();
});
@@ -500,7 +500,7 @@ describe('RuleViewer', () => {
expect.objectContaining({
ruleUid: 'test-rule-uid',
}),
- expect.any(Object)
+ undefined
);
expect(screen.getByTestId('enrichment-section')).toBeInTheDocument();
});
diff --git a/public/app/features/annotations/components/StandardAnnotationQueryEditor.test.tsx b/public/app/features/annotations/components/StandardAnnotationQueryEditor.test.tsx
index 9c4d52373ee..619d4d09521 100644
--- a/public/app/features/annotations/components/StandardAnnotationQueryEditor.test.tsx
+++ b/public/app/features/annotations/components/StandardAnnotationQueryEditor.test.tsx
@@ -67,7 +67,7 @@ describe('StandardAnnotationQueryEditor', () => {
expect.objectContaining({
query: expect.objectContaining({ queryType: 'defaultAnnotationsQuery', refId: 'initialAnnotationRef' }),
}),
- expect.anything()
+ undefined
);
});
@@ -85,7 +85,7 @@ describe('StandardAnnotationQueryEditor', () => {
expect.objectContaining({
query: expect.objectContaining({ refId: 'initialAnnotationRef' }),
}),
- expect.anything()
+ undefined
);
});
@@ -204,7 +204,7 @@ describe('StandardAnnotationQueryEditor', () => {
refId: 'A',
}),
}),
- expect.anything()
+ undefined
);
});
@@ -242,7 +242,7 @@ describe('StandardAnnotationQueryEditor', () => {
legendFormat: '{{method}} {{endpoint}}',
}),
}),
- expect.anything()
+ undefined
);
});
@@ -284,7 +284,7 @@ describe('StandardAnnotationQueryEditor', () => {
refId: 'AnnoTarget',
}),
}),
- expect.anything()
+ undefined
);
});
@@ -320,7 +320,7 @@ describe('StandardAnnotationQueryEditor', () => {
expr: 'up',
}),
}),
- expect.anything()
+ undefined
);
});
diff --git a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.test.tsx b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.test.tsx
index 35eaec800d1..2c22cd5e88b 100644
--- a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.test.tsx
+++ b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.test.tsx
@@ -38,7 +38,7 @@ describe('ShareDrawer', () => {
expect(locationService.getSearch().get('shareView')).toBe('link');
expect(await screen.findByText('Share externally')).toBeInTheDocument();
const closeButton = await screen.findByTestId(selectors.components.Drawer.General.close);
- await act(() => userEvent.click(closeButton));
+ await userEvent.click(closeButton);
expect(locationService.getSearch().get('shareView')).toBe(null);
});
diff --git a/public/app/features/dashboard/containers/DashboardPageProxy.test.tsx b/public/app/features/dashboard/containers/DashboardPageProxy.test.tsx
index e26b1099d2d..5083affcf22 100644
--- a/public/app/features/dashboard/containers/DashboardPageProxy.test.tsx
+++ b/public/app/features/dashboard/containers/DashboardPageProxy.test.tsx
@@ -1,4 +1,4 @@
-import { act, screen, waitFor } from '@testing-library/react';
+import { screen, waitFor } from '@testing-library/react';
import { useParams } from 'react-router-dom-v5-compat';
import { Props } from 'react-virtualized-auto-sizer';
import { render } from 'test/test-utils';
@@ -120,10 +120,8 @@ describe('DashboardPageProxy', () => {
it('home dashboard', async () => {
getDashboardScenePageStateManager().setDashboardCache(HOME_DASHBOARD_CACHE_KEY, dashMock);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
- });
+ setup({
+ route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
});
await waitFor(() => {
@@ -134,11 +132,9 @@ describe('DashboardPageProxy', () => {
it('uid dashboard', async () => {
getDashboardScenePageStateManager().setDashboardCache('abc-def', dashMock);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
- uid: 'abc-def',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
+ uid: 'abc-def',
});
await waitFor(() => {
@@ -156,11 +152,9 @@ describe('DashboardPageProxy', () => {
describe('when user can edit a dashboard ', () => {
it('should not render DashboardScenePage if route is Home', async () => {
getDashboardScenePageStateManager().setDashboardCache(HOME_DASHBOARD_CACHE_KEY, homeMockEditable);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
- uid: '',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
+ uid: '',
});
await waitFor(() => {
@@ -170,11 +164,9 @@ describe('DashboardPageProxy', () => {
it('should not render DashboardScenePage if route is Normal and has uid', async () => {
getDashboardScenePageStateManager().setDashboardCache('abc-def', dashMockEditable);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
- uid: 'abc-def',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
+ uid: 'abc-def',
});
await waitFor(() => {
expect(screen.queryAllByTestId('dashboard-scene-page')).toHaveLength(0);
@@ -185,11 +177,9 @@ describe('DashboardPageProxy', () => {
describe('when user can only view a dashboard ', () => {
it('should render DashboardScenePage if route is Home', async () => {
getDashboardScenePageStateManager().setDashboardCache(HOME_DASHBOARD_CACHE_KEY, homeMock);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
- uid: '',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
+ uid: '',
});
await waitFor(() => {
@@ -199,11 +189,9 @@ describe('DashboardPageProxy', () => {
it('should render DashboardScenePage if route is Normal and has uid', async () => {
getDashboardScenePageStateManager().setDashboardCache('uid', dashMock);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
- uid: 'uid',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
+ uid: 'uid',
});
await waitFor(() => {
expect(screen.queryAllByTestId('dashboard-scene-page')).toHaveLength(1);
@@ -212,11 +200,9 @@ describe('DashboardPageProxy', () => {
it('should render not DashboardScenePage if dashboard UID does not match route UID', async () => {
getDashboardScenePageStateManager().setDashboardCache('uid', dashMock);
- act(() => {
- setup({
- route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
- uid: 'wrongUID',
- });
+ setup({
+ route: { routeName: DashboardRoutes.Normal, component: () => null, path: '/' },
+ uid: 'wrongUID',
});
await waitFor(() => {
expect(screen.queryAllByTestId('dashboard-scene-page')).toHaveLength(0);
diff --git a/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx b/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx
index 0bb44738440..495532e5951 100644
--- a/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx
+++ b/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx
@@ -5,7 +5,7 @@ import { render } from 'test/test-utils';
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
import { config, locationService } from '@grafana/runtime';
import { backendSrv } from 'app/core/services/backend_srv';
-import { DashboardRoutes } from 'app/types/dashboard';
+import { DashboardDTO, DashboardRoutes } from 'app/types/dashboard';
import PublicDashboardPageProxy, { PublicDashboardPageProxyProps } from './PublicDashboardPageProxy';
@@ -56,8 +56,7 @@ describe('PublicDashboardPageProxy', () => {
// Mock the dashboard UID response so we don't get any refused connection errors
// from this test (as the fetch polyfill means this logic would actually try and call the API)
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- jest.spyOn(backendSrv, 'getPublicDashboardByUid').mockResolvedValue({ dashboard: {}, meta: {} } as any);
+ jest.spyOn(backendSrv, 'getPublicDashboardByUid').mockResolvedValue({ dashboard: {}, meta: {} } as DashboardDTO);
});
describe('when scene feature enabled', () => {
diff --git a/public/app/features/datasources/components/picker/DataSourceModal.test.tsx b/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
index 7ab78dda2ca..116282707e0 100644
--- a/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
+++ b/public/app/features/datasources/components/picker/DataSourceModal.test.tsx
@@ -19,7 +19,7 @@ const pluginMetaInfo: PluginMetaInfo = {
version: '',
updated: '',
links: [],
- logos: { small: '', large: '' },
+ logos: { small: 'small.png', large: 'large.png' },
};
function createPluginMeta(name: string, builtIn: boolean): DataSourcePluginMeta {
diff --git a/public/app/features/explore/TraceView/components/common/SearchBarInput.tsx b/public/app/features/explore/TraceView/components/common/SearchBarInput.tsx
index a6527ca1c0e..831aa856dbf 100644
--- a/public/app/features/explore/TraceView/components/common/SearchBarInput.tsx
+++ b/public/app/features/explore/TraceView/components/common/SearchBarInput.tsx
@@ -22,7 +22,7 @@ type Props = {
onChange: (value: string) => void;
};
-const SearchBarInput = memo(({ value, onChange }: Props) => {
+const SearchBarInput = memo(({ value = '', onChange }: Props) => {
const clearUiFind = () => {
onChange('');
};
diff --git a/public/app/features/explore/spec/helper/setup.tsx b/public/app/features/explore/spec/helper/setup.tsx
index 647284ad25c..3b4295b3cac 100644
--- a/public/app/features/explore/spec/helper/setup.tsx
+++ b/public/app/features/explore/spec/helper/setup.tsx
@@ -265,8 +265,8 @@ export function makeDatasourceSetup({
updated: '',
version: '',
logos: {
- small: '',
- large: '',
+ small: 'small.png',
+ large: 'large.png',
},
},
id: id.toString(),
diff --git a/public/app/features/plugins/extensions/utils.test.tsx b/public/app/features/plugins/extensions/utils.test.tsx
index 2c1563f8f6c..4e00a80cf27 100644
--- a/public/app/features/plugins/extensions/utils.test.tsx
+++ b/public/app/features/plugins/extensions/utils.test.tsx
@@ -785,7 +785,6 @@ describe('Plugin Extensions / Utils', () => {
expect(log.error).toHaveBeenCalledWith(`Extension "${pluginId}/${extensionTitle}" failed to load.`, {
message: 'Test error',
componentStack: expect.any(String),
- digest: expect.any(String),
});
expect(screen.getByText(`Extension failed to load: "${pluginId}/${extensionTitle}"`)).toBeVisible();
@@ -818,7 +817,6 @@ describe('Plugin Extensions / Utils', () => {
expect(log.error).toHaveBeenCalledWith(`Extension "${pluginId}/${extensionTitle}" failed to load.`, {
message: 'Test error',
componentStack: expect.any(String),
- digest: expect.any(String),
});
expect(screen.getByText(`Extension failed to load: "${pluginId}/${extensionTitle}"`)).toBeVisible();
@@ -965,7 +963,6 @@ describe('Plugin Extensions / Utils', () => {
expect(log.error).toHaveBeenCalledWith(`Extension "${pluginId}/${extensionTitle}" failed to load.`, {
message: 'Test error',
componentStack: expect.any(String),
- digest: expect.any(String),
});
});
@@ -995,7 +992,6 @@ describe('Plugin Extensions / Utils', () => {
expect(log.error).toHaveBeenCalledWith(`Extension "${pluginId}/${extensionTitle}" failed to load.`, {
message: 'Test error',
componentStack: expect.any(String),
- digest: expect.any(String),
});
});
});