paths.spec.ts 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import { GIT_REPO_LINK } from 'lib/constants';
  2. import * as paths from 'lib/paths';
  3. const clusterName = 'test-cluster-name';
  4. const groupId = 'test-group-id';
  5. const schemaId = 'test-schema-id';
  6. const topicId = 'test-topic-id';
  7. const connectName = 'test-connect-name';
  8. const connectorName = 'test-connector-name';
  9. describe('Paths', () => {
  10. it('gitCommitPath', () => {
  11. expect(paths.gitCommitPath('1234567gh')).toEqual(
  12. `${GIT_REPO_LINK}/commit/1234567gh`
  13. );
  14. });
  15. it('clusterPath', () => {
  16. expect(paths.clusterPath(clusterName)).toEqual(
  17. `/ui/clusters/${clusterName}`
  18. );
  19. });
  20. it('clusterBrokersPath', () => {
  21. expect(paths.clusterBrokersPath(clusterName)).toEqual(
  22. `${paths.clusterPath(clusterName)}/brokers`
  23. );
  24. });
  25. it('clusterConsumerGroupsPath', () => {
  26. expect(paths.clusterConsumerGroupsPath(clusterName)).toEqual(
  27. `${paths.clusterPath(clusterName)}/consumer-groups`
  28. );
  29. });
  30. it('clusterConsumerGroupDetailsPath', () => {
  31. expect(paths.clusterConsumerGroupDetailsPath(clusterName, groupId)).toEqual(
  32. `${paths.clusterConsumerGroupsPath(clusterName)}/${groupId}`
  33. );
  34. });
  35. it('clusterConsumerGroupResetOffsetsPath', () => {
  36. expect(
  37. paths.clusterConsumerGroupResetOffsetsPath(clusterName, groupId)
  38. ).toEqual(
  39. `${paths.clusterConsumerGroupDetailsPath(
  40. clusterName,
  41. groupId
  42. )}/reset-offsets`
  43. );
  44. });
  45. it('clusterSchemasPath', () => {
  46. expect(paths.clusterSchemasPath(clusterName)).toEqual(
  47. `${paths.clusterPath(clusterName)}/schemas`
  48. );
  49. });
  50. it('clusterSchemaNewPath', () => {
  51. expect(paths.clusterSchemaNewPath(clusterName)).toEqual(
  52. `${paths.clusterSchemasPath(clusterName)}/create-new`
  53. );
  54. });
  55. it('clusterSchemaPath', () => {
  56. expect(paths.clusterSchemaPath(clusterName, schemaId)).toEqual(
  57. `${paths.clusterSchemasPath(clusterName)}/${schemaId}`
  58. );
  59. });
  60. it('clusterSchemaEditPath', () => {
  61. expect(paths.clusterSchemaEditPath(clusterName, schemaId)).toEqual(
  62. `${paths.clusterSchemaPath(clusterName, schemaId)}/edit`
  63. );
  64. });
  65. it('clusterTopicsPath', () => {
  66. expect(paths.clusterTopicsPath(clusterName)).toEqual(
  67. `${paths.clusterPath(clusterName)}/topics`
  68. );
  69. });
  70. it('clusterTopicNewPath', () => {
  71. expect(paths.clusterTopicNewPath(clusterName)).toEqual(
  72. `${paths.clusterTopicsPath(clusterName)}/create-new`
  73. );
  74. });
  75. it('clusterTopicPath', () => {
  76. expect(paths.clusterTopicPath(clusterName, topicId)).toEqual(
  77. `${paths.clusterTopicsPath(clusterName)}/${topicId}`
  78. );
  79. });
  80. it('clusterTopicSettingsPath', () => {
  81. expect(paths.clusterTopicSettingsPath(clusterName, topicId)).toEqual(
  82. `${paths.clusterTopicPath(clusterName, topicId)}/settings`
  83. );
  84. });
  85. it('clusterTopicConsumerGroupsPath', () => {
  86. expect(paths.clusterTopicConsumerGroupsPath(clusterName, topicId)).toEqual(
  87. `${paths.clusterTopicPath(clusterName, topicId)}/consumer-groups`
  88. );
  89. });
  90. it('clusterTopicMessagesPath', () => {
  91. expect(paths.clusterTopicMessagesPath(clusterName, topicId)).toEqual(
  92. `${paths.clusterTopicPath(clusterName, topicId)}/messages`
  93. );
  94. });
  95. it('clusterTopicSendMessagePath', () => {
  96. expect(paths.clusterTopicSendMessagePath(clusterName, topicId)).toEqual(
  97. `${paths.clusterTopicPath(clusterName, topicId)}/message`
  98. );
  99. });
  100. it('clusterTopicEditPath', () => {
  101. expect(paths.clusterTopicEditPath(clusterName, topicId)).toEqual(
  102. `${paths.clusterTopicPath(clusterName, topicId)}/edit`
  103. );
  104. });
  105. it('clusterConnectsPath', () => {
  106. expect(paths.clusterConnectsPath(clusterName)).toEqual(
  107. `${paths.clusterPath(clusterName)}/connects`
  108. );
  109. });
  110. it('clusterConnectorsPath', () => {
  111. expect(paths.clusterConnectorsPath(clusterName)).toEqual(
  112. `${paths.clusterPath(clusterName)}/connectors`
  113. );
  114. });
  115. it('clusterConnectorNewPath', () => {
  116. expect(paths.clusterConnectorNewPath(clusterName)).toEqual(
  117. `${paths.clusterConnectorsPath(clusterName)}/create-new`
  118. );
  119. });
  120. it('clusterConnectConnectorPath', () => {
  121. expect(
  122. paths.clusterConnectConnectorPath(clusterName, connectName, connectorName)
  123. ).toEqual(
  124. `${paths.clusterConnectsPath(
  125. clusterName
  126. )}/${connectName}/connectors/${connectorName}`
  127. );
  128. });
  129. it('clusterConnectConnectorEditPath', () => {
  130. expect(
  131. paths.clusterConnectConnectorEditPath(
  132. clusterName,
  133. connectName,
  134. connectorName
  135. )
  136. ).toEqual(
  137. `${paths.clusterConnectConnectorPath(
  138. clusterName,
  139. connectName,
  140. connectorName
  141. )}/edit`
  142. );
  143. });
  144. it('clusterConnectConnectorTasksPath', () => {
  145. expect(
  146. paths.clusterConnectConnectorTasksPath(
  147. clusterName,
  148. connectName,
  149. connectorName
  150. )
  151. ).toEqual(
  152. `${paths.clusterConnectConnectorPath(
  153. clusterName,
  154. connectName,
  155. connectorName
  156. )}/tasks`
  157. );
  158. });
  159. it('clusterConnectConnectorConfigPath', () => {
  160. expect(
  161. paths.clusterConnectConnectorConfigPath(
  162. clusterName,
  163. connectName,
  164. connectorName
  165. )
  166. ).toEqual(
  167. `${paths.clusterConnectConnectorPath(
  168. clusterName,
  169. connectName,
  170. connectorName
  171. )}/config`
  172. );
  173. });
  174. it('clusterKsqlDbPath', () => {
  175. expect(paths.clusterKsqlDbPath(clusterName)).toEqual(
  176. `${paths.clusterPath(clusterName)}/ksqldb`
  177. );
  178. });
  179. it('clusterKsqlDbPath with default value', () => {
  180. expect(paths.clusterKsqlDbPath()).toEqual(
  181. `${paths.clusterPath(':clusterName')}/ksqldb`
  182. );
  183. });
  184. it('clusterKsqlDbQueryPath', () => {
  185. expect(paths.clusterKsqlDbQueryPath(clusterName)).toEqual(
  186. `${paths.clusterKsqlDbPath(clusterName)}/query`
  187. );
  188. });
  189. it('clusterKsqlDbQueryPath with default value', () => {
  190. expect(paths.clusterKsqlDbQueryPath()).toEqual(
  191. `${paths.clusterKsqlDbPath(':clusterName')}/query`
  192. );
  193. });
  194. });