apiTokenRow.spec.tsx 563 B

1234567891011121314151617
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import ApiTokenRow from 'sentry/views/settings/account/apiTokenRow';
  3. describe('ApiTokenRow', () => {
  4. it('renders', () => {
  5. render(<ApiTokenRow onRemove={() => {}} token={TestStubs.ApiToken()} />);
  6. });
  7. it('calls onRemove callback when trash can is clicked', async () => {
  8. const cb = jest.fn();
  9. render(<ApiTokenRow onRemove={cb} token={TestStubs.ApiToken()} />);
  10. await userEvent.click(screen.getByLabelText('Remove'));
  11. expect(cb).toHaveBeenCalled();
  12. });
  13. });