integrationRow.spec.tsx 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import IntegrationRow from 'sentry/views/settings/organizationIntegrations/integrationRow';
  4. describe('IntegrationRow', function () {
  5. const {organization: org, routerContext} = initializeOrg();
  6. describe('SentryApp', function () {
  7. it('is an internal SentryApp', function () {
  8. render(
  9. <IntegrationRow
  10. organization={org}
  11. type="sentryApp"
  12. slug="my-headband-washer-289499"
  13. displayName="My Headband Washer"
  14. status="Installed"
  15. publishStatus="internal"
  16. configurations={0}
  17. categories={[]}
  18. />
  19. );
  20. expect(screen.getByText('My Headband Washer')).toBeInTheDocument();
  21. expect(screen.getByText('Installed')).toBeInTheDocument();
  22. expect(screen.getByText('internal')).toBeInTheDocument();
  23. });
  24. it('is a published SentryApp', function () {
  25. render(
  26. <IntegrationRow
  27. organization={org}
  28. type="sentryApp"
  29. slug="clickup"
  30. displayName="ClickUp"
  31. status="Not Installed"
  32. publishStatus="published"
  33. configurations={0}
  34. categories={[]}
  35. />,
  36. {context: routerContext}
  37. );
  38. expect(screen.getByText('ClickUp')).toBeInTheDocument();
  39. expect(screen.getByText('ClickUp')).toHaveAttribute(
  40. 'href',
  41. `/settings/${org.slug}/sentry-apps/clickup/`
  42. );
  43. expect(screen.getByText('Not Installed')).toBeInTheDocument();
  44. });
  45. });
  46. describe('First Party Integration', function () {
  47. it('has been installed (1 configuration)', function () {
  48. render(
  49. <IntegrationRow
  50. organization={org}
  51. type="firstParty"
  52. slug="bitbucket"
  53. displayName="Bitbucket"
  54. status="Installed"
  55. publishStatus="published"
  56. configurations={1}
  57. categories={[]}
  58. />,
  59. {context: routerContext}
  60. );
  61. expect(screen.getByText('Bitbucket')).toBeInTheDocument();
  62. expect(screen.getByText('Bitbucket')).toHaveAttribute(
  63. 'href',
  64. `/settings/${org.slug}/integrations/bitbucket/`
  65. );
  66. expect(screen.getByText('1 Configuration')).toBeInTheDocument();
  67. });
  68. it('has been installed (3 configurations)', function () {
  69. render(
  70. <IntegrationRow
  71. organization={org}
  72. type="firstParty"
  73. slug="bitbucket"
  74. displayName="Bitbucket"
  75. status="Installed"
  76. publishStatus="published"
  77. configurations={3}
  78. categories={[]}
  79. />,
  80. {context: routerContext}
  81. );
  82. expect(screen.getByText('Installed')).toBeInTheDocument();
  83. expect(screen.getByText('Bitbucket')).toHaveAttribute(
  84. 'href',
  85. `/settings/${org.slug}/integrations/bitbucket/`
  86. );
  87. expect(screen.getByText('3 Configurations')).toBeInTheDocument();
  88. });
  89. it('has not been installed', function () {
  90. render(
  91. <IntegrationRow
  92. organization={org}
  93. type="firstParty"
  94. slug="github"
  95. displayName="Github"
  96. status="Not Installed"
  97. publishStatus="published"
  98. configurations={0}
  99. categories={[]}
  100. />,
  101. {context: routerContext}
  102. );
  103. expect(screen.getByText('Not Installed')).toBeInTheDocument();
  104. expect(screen.getByText('Github')).toHaveAttribute(
  105. 'href',
  106. `/settings/${org.slug}/integrations/github/`
  107. );
  108. });
  109. });
  110. describe('Plugin', function () {
  111. it('has been installed (1 project)', function () {
  112. render(
  113. <IntegrationRow
  114. organization={org}
  115. type="plugin"
  116. slug="twilio"
  117. displayName="Twilio (SMS) "
  118. status="Installed"
  119. publishStatus="published"
  120. configurations={1}
  121. categories={[]}
  122. />,
  123. {context: routerContext}
  124. );
  125. expect(screen.getByText('Installed')).toBeInTheDocument();
  126. expect(screen.getByText('1 Configuration')).toBeInTheDocument();
  127. expect(screen.getByText('Twilio (SMS)')).toHaveAttribute(
  128. 'href',
  129. `/settings/${org.slug}/plugins/twilio/`
  130. );
  131. });
  132. it('has been installed (3 projects)', function () {
  133. render(
  134. <IntegrationRow
  135. organization={org}
  136. type="plugin"
  137. slug="twilio"
  138. displayName="Twilio (SMS) "
  139. status="Installed"
  140. publishStatus="published"
  141. configurations={3}
  142. categories={[]}
  143. />,
  144. {context: routerContext}
  145. );
  146. expect(screen.getByText('Installed')).toBeInTheDocument();
  147. expect(screen.getByText('3 Configurations')).toBeInTheDocument();
  148. expect(screen.getByText('Twilio (SMS)')).toHaveAttribute(
  149. 'href',
  150. `/settings/${org.slug}/plugins/twilio/`
  151. );
  152. });
  153. it('has not been installed', function () {
  154. render(
  155. <IntegrationRow
  156. organization={org}
  157. type="plugin"
  158. slug="amazon-sqs"
  159. displayName="Amazon SQS"
  160. status="Not Installed"
  161. publishStatus="published"
  162. configurations={0}
  163. categories={[]}
  164. />
  165. );
  166. expect(screen.getByText('Not Installed')).toBeInTheDocument();
  167. expect(screen.getByText('Amazon SQS')).toBeInTheDocument();
  168. });
  169. });
  170. });