apiTokenRow.spec.tsx 661 B

12345678910111213141516171819202122
  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. const wrapper = render(
  6. <ApiTokenRow onRemove={() => {}} token={TestStubs.ApiToken()} />
  7. );
  8. // Should be loading
  9. expect(wrapper.container).toSnapshot();
  10. });
  11. it('calls onRemove callback when trash can is clicked', async () => {
  12. const cb = jest.fn();
  13. render(<ApiTokenRow onRemove={cb} token={TestStubs.ApiToken()} />);
  14. await userEvent.click(screen.getByLabelText('Remove'));
  15. expect(cb).toHaveBeenCalled();
  16. });
  17. });