paths.spec.ts 5.9 KB

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