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.2 KB
Raw Blame
import { PanelMode } from 'lib/visualization/panels/types';
import { render } from 'tests/test-utils';
import { Widgets } from 'types/api/widgets/widget';

import TablePanelWrapper from 'container/WidgetCard/Panels/TablePanelWrapper';
import {
	tablePanelQueryResponse,
	tablePanelWidgetQuery,
} from 'container/WidgetCard/Panels/__tests__/tablePanelWrapperHelper';

describe('Table panel wrappper tests', () => {
	it('table should render fine with the query response and column units', () => {
		const { container, getByText } = render(
			<TablePanelWrapper
				panelMode={PanelMode.DASHBOARD_VIEW}
				widget={tablePanelWidgetQuery as unknown as Widgets}
				queryResponse={tablePanelQueryResponse as unknown as any}
				onDragSelect={(): void => {}}
			/>,
		);
		// checking the overall rendering of the table
		expect(container).toMatchSnapshot();

		// the first row of the table should have the latency value with units
		expect(getByText('4.35 s')).toBeInTheDocument();

		// the rows should have optimised value for human readability
		expect(getByText('31.3 ms')).toBeInTheDocument();

		// the applied legend should appear as the column header
		expect(getByText('latency-per-service')).toBeInTheDocument();
	});
});