Sparkline: Add test to make sure the Sparkline at least renders (#94880)

add test to make sure the sparkline at least renders
This commit is contained in:
Ashley Harrison 2024-10-17 14:38:11 +01:00 committed by GitHub
parent 4083b2208e
commit 95ad094438
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,30 @@
import { render } from '@testing-library/react';
import { createTheme, FieldSparkline, FieldType } from '@grafana/data';
import { Sparkline } from './Sparkline';
describe('Sparkline', () => {
it('should render without throwing an error', () => {
const sparkline: FieldSparkline = {
x: {
name: 'x',
values: [1679839200000, 1680444000000, 1681048800000, 1681653600000, 1682258400000],
type: FieldType.time,
config: {},
},
y: {
name: 'y',
values: [1, 2, 3, 4, 5],
type: FieldType.number,
config: {},
state: {
range: { min: 1, max: 5, delta: 1 },
},
},
};
expect(() =>
render(<Sparkline width={800} height={600} theme={createTheme()} sparkline={sparkline} />)
).not.toThrow();
});
});