test(gauge): fix failing test due to mock not working

This commit is contained in:
Jack Westbrook
2025-03-03 09:43:27 +01:00
parent 1a3a100de5
commit b14f695bf7
@@ -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(<Gauge {...props} />)).not.toThrow();
});