The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/explore/TimeSyncButton.test.tsx

19 lines
647 B

import { render, screen } from '@testing-library/react';
import { TimeSyncButton } from './TimeSyncButton';
const setup = (isSynced: boolean) => {
const onClick = () => {};
return render(<TimeSyncButton onClick={onClick} isSynced={isSynced} />);
};
describe('TimeSyncButton', () => {
it('should have the right name when isSynced = true', () => {
setup(true);
expect(screen.getByRole('button', { name: /synced times/i })).toBeInTheDocument();
});
it('should have the right name when isSynced = false', () => {
setup(false);
expect(screen.getByRole('button', { name: /unsynced times/i })).toBeInTheDocument();
});
});