some tests for this case

This commit is contained in:
Paul Marbach
2025-11-19 16:17:58 -05:00
parent f00b83f3b6
commit 3e08e784c5
@@ -27,4 +27,48 @@ describe('Sparkline', () => {
render(<Sparkline width={800} height={600} theme={createTheme()} sparkline={sparkline} />)
).not.toThrow();
});
it('should ot throw an error if there is a single value', () => {
const sparkline: FieldSparkline = {
x: {
name: 'x',
values: [1679839200000],
type: FieldType.time,
config: {},
},
y: {
name: 'y',
values: [1],
type: FieldType.number,
config: {},
state: {
range: { min: 1, max: 1, delta: 0 },
},
},
};
expect(() =>
render(<Sparkline width={800} height={600} theme={createTheme()} sparkline={sparkline} />)
).not.toThrow();
});
it('should ot throw an error if there are no values', () => {
const sparkline: FieldSparkline = {
x: {
name: 'x',
values: [],
type: FieldType.time,
config: {},
},
y: {
name: 'y',
values: [],
type: FieldType.number,
config: {},
state: {},
},
};
expect(() =>
render(<Sparkline width={800} height={600} theme={createTheme()} sparkline={sparkline} />)
).not.toThrow();
});
});