integrationRow.spec.tsx 5.1 KB

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