mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-17 05:31:27 +08:00

* refactor: setup wrapper for all the providers * refactor: done with unit test configuration and service layer testing * refactor: checking for multiple services * refactor: updated test cases added table sort * refactor: moved hooks mocking to test-utils * refactor: added the search test case * refactor: updated the handler with mocks data
30 lines
1009 B
TypeScript
30 lines
1009 B
TypeScript
import { render, screen, waitFor } from 'tests/test-utils';
|
|
|
|
import { Services } from './__mock__/servicesListMock';
|
|
import Metrics from './index';
|
|
|
|
describe('Metrics Component', () => {
|
|
it('renders without errors', async () => {
|
|
render(<Metrics services={Services} isLoading={false} />);
|
|
|
|
await waitFor(() => {
|
|
expect(screen.getByText(/application/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/p99 latency \(in ms\)/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/error rate \(% of total\)/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/operations per second/i)).toBeInTheDocument();
|
|
});
|
|
});
|
|
|
|
it('renders if the data is loaded in the table', async () => {
|
|
render(<Metrics services={Services} isLoading={false} />);
|
|
|
|
expect(screen.getByText('frontend')).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders no data when required conditions are met', async () => {
|
|
render(<Metrics services={[]} isLoading={false} />);
|
|
|
|
expect(screen.getByText('No data')).toBeInTheDocument();
|
|
});
|
|
});
|