organizationApiKeysList.spec.tsx 920 B

1234567891011121314151617181920212223242526272829303132
  1. import {DeprecatedApiKeyFixture} from 'sentry-fixture/deprecatedApiKey';
  2. import {OrganizationFixture} from 'sentry-fixture/organization';
  3. import {
  4. render,
  5. renderGlobalModal,
  6. screen,
  7. userEvent,
  8. } from 'sentry-test/reactTestingLibrary';
  9. import OrganizationApiKeysList from 'sentry/views/settings/organizationApiKeys/organizationApiKeysList';
  10. describe('OrganizationApiKeysList', function () {
  11. it('opens a modal when trying to delete a key', async function () {
  12. render(
  13. <OrganizationApiKeysList
  14. organization={OrganizationFixture()}
  15. keys={[DeprecatedApiKeyFixture()]}
  16. busy={false}
  17. loading={false}
  18. onRemove={jest.fn()}
  19. onAddApiKey={jest.fn()}
  20. />
  21. );
  22. renderGlobalModal();
  23. // Click remove button
  24. await userEvent.click(await screen.findByTitle('Remove API Key?'));
  25. expect(screen.getByRole('dialog')).toBeInTheDocument();
  26. });
  27. });