From b14f695bf7c6f6812986505f2cbbeefa115bd7ec Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Wed, 6 Mar 2024 11:46:35 +0100 Subject: [PATCH] test(gauge): fix failing test due to mock not working --- packages/grafana-ui/src/components/Gauge/Gauge.test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx index 5c0c80cceec..7dc50f085ba 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.test.tsx @@ -1,14 +1,11 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import $ from 'jquery'; import { ThresholdsMode, FieldConfig, FieldColorModeId, createTheme } from '@grafana/data'; import { Gauge, Props } from './Gauge'; -jest.mock('jquery', () => ({ - plot: jest.fn(), -})); - const field: FieldConfig = { min: 0, max: 100, @@ -38,6 +35,9 @@ const props: Props = { }; describe('Gauge', () => { + // @ts-ignore - mock jquery plot to prevent console.errors + $.plot = jest.fn(); + it('should render without blowing up', () => { expect(() => render()).not.toThrow(); });