docIntegrationDetailedView.spec.tsx 1.4 KB

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