Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

1.0 KB
Raw Blame
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import getSeries from '../getSeriesData';
import {
	seriesBarChartData,
	seriesLineChartData,
} from './__mocks__/seriesData';

jest.mock('../getRenderer', () => jest.fn().mockImplementation(() => () => {}));

describe('Get Series Data', () => {
	it('Should return series data for uplot chart', () => {
		const seriesData = getSeries(seriesBarChartData);
		expect(seriesData).toHaveLength(5);
		expect(seriesData[1].label).toBe('firstLegend');
		expect(seriesData[1].show).toBe(true);
		expect(seriesData[1].fill).toBe('#83C2EB');
		expect(seriesData[1].width).toBe(2);
	});

	it('Should return series drawline bar chart for panel type barchart', () => {
		const seriesData = getSeries(seriesBarChartData);
		// @ts-expect-error
		expect(seriesData[1].drawStyle).toBe('bars');
	});

	it('Should return seris drawline line chart for panel type time series', () => {
		const seriesData = getSeries(seriesLineChartData);
		// @ts-expect-error

		expect(seriesData[1].drawStyle).toBe('line');
	});
});