TimeSyncButton.test.tsx 674 B

1234567891011121314151617181920
  1. import { render, screen } from '@testing-library/react';
  2. import React from 'react';
  3. import { TimeSyncButton } from './TimeSyncButton';
  4. const setup = (isSynced: boolean) => {
  5. const onClick = () => {};
  6. return render(<TimeSyncButton onClick={onClick} isSynced={isSynced} />);
  7. };
  8. describe('TimeSyncButton', () => {
  9. it('should have the right name when isSynced = true', () => {
  10. setup(true);
  11. expect(screen.getByRole('button', { name: /synced times/i })).toBeInTheDocument();
  12. });
  13. it('should have the right name when isSynced = false', () => {
  14. setup(false);
  15. expect(screen.getByRole('button', { name: /unsynced times/i })).toBeInTheDocument();
  16. });
  17. });