docIntegrationDetailedView.spec.jsx 1.4 KB

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