docIntegrationDetailedView.spec.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {DocIntegrationFixture} from 'sentry-fixture/docIntegration';
  2. import {initializeOrg} from 'sentry-test/initializeOrg';
  3. import {render, screen} from 'sentry-test/reactTestingLibrary';
  4. import DocIntegrationDetailedView from 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView';
  5. describe('DocIntegrationDetailedView', function () {
  6. const {routerProps, organization} = initializeOrg();
  7. const doc = DocIntegrationFixture();
  8. beforeEach(function () {});
  9. it('renders', async function () {
  10. const getMock = MockApiClient.addMockResponse({
  11. url: `/doc-integrations/${doc.slug}/`,
  12. body: doc,
  13. });
  14. render(
  15. <DocIntegrationDetailedView
  16. {...routerProps}
  17. organization={organization}
  18. params={{integrationSlug: doc.slug}}
  19. />
  20. );
  21. await tick();
  22. expect(getMock).toHaveBeenCalledTimes(1);
  23. const docLink = screen.getByTestId('learn-more');
  24. expect(docLink).toBeInTheDocument();
  25. expect(docLink).toHaveAttribute('href', doc.url);
  26. expect(screen.getByText(doc.author)).toBeInTheDocument();
  27. expect(screen.getByText(doc.description)).toBeInTheDocument();
  28. for (const resource of doc.resources || []) {
  29. const link = screen.getByText(resource.title);
  30. expect(link).toBeInTheDocument();
  31. expect(link).toHaveAttribute('href', resource.url);
  32. }
  33. for (const feature of doc.features || []) {
  34. expect(screen.getByText(feature.description)).toBeInTheDocument();
  35. }
  36. });
  37. });