123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- import { GIT_REPO_LINK } from 'lib/constants';
- import * as paths from 'lib/paths';
- import { RouteParams } from 'lib/paths';
- const clusterName = 'test-cluster-name';
- const groupId = 'test-group-id';
- const schemaId = 'test-schema-id';
- const topicId = 'test-topic-id';
- const brokerId = 'test-Broker-id';
- const connectName = 'test-connect-name';
- const connectorName = 'test-connector-name';
- describe('Paths', () => {
- it('gitCommitPath', () => {
- expect(paths.gitCommitPath('1234567gh')).toEqual(
- `${GIT_REPO_LINK}/commit/1234567gh`
- );
- });
- it('clusterPath', () => {
- expect(paths.clusterPath(clusterName)).toEqual(
- `/ui/clusters/${clusterName}`
- );
- expect(paths.clusterPath()).toEqual(
- paths.clusterPath(RouteParams.clusterName)
- );
- });
- it('clusterBrokersPath', () => {
- expect(paths.clusterBrokersPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/brokers`
- );
- expect(paths.clusterBrokersPath()).toEqual(
- paths.clusterBrokersPath(RouteParams.clusterName)
- );
- expect(paths.clusterBrokerPath(clusterName, brokerId)).toEqual(
- `${paths.clusterPath(clusterName)}/brokers/${brokerId}`
- );
- expect(paths.clusterBrokerPath()).toEqual(
- paths.clusterBrokerPath(RouteParams.clusterName, RouteParams.brokerId)
- );
- expect(paths.clusterBrokerMetricsPath(clusterName, brokerId)).toEqual(
- `${paths.clusterPath(clusterName)}/brokers/${brokerId}/metrics`
- );
- expect(paths.clusterBrokerMetricsPath()).toEqual(
- paths.clusterBrokerMetricsPath(
- RouteParams.clusterName,
- RouteParams.brokerId
- )
- );
- });
- it('clusterConsumerGroupsPath', () => {
- expect(paths.clusterConsumerGroupsPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/consumer-groups`
- );
- expect(paths.clusterConsumerGroupsPath()).toEqual(
- paths.clusterConsumerGroupsPath(RouteParams.clusterName)
- );
- });
- it('clusterConsumerGroupDetailsPath', () => {
- expect(paths.clusterConsumerGroupDetailsPath(clusterName, groupId)).toEqual(
- `${paths.clusterConsumerGroupsPath(clusterName)}/${groupId}`
- );
- expect(paths.clusterConsumerGroupDetailsPath()).toEqual(
- paths.clusterConsumerGroupDetailsPath(
- RouteParams.clusterName,
- RouteParams.consumerGroupID
- )
- );
- });
- it('clusterConsumerGroupResetOffsetsPath', () => {
- expect(
- paths.clusterConsumerGroupResetOffsetsPath(clusterName, groupId)
- ).toEqual(
- `${paths.clusterConsumerGroupDetailsPath(
- clusterName,
- groupId
- )}/reset-offsets`
- );
- expect(paths.clusterConsumerGroupResetOffsetsPath()).toEqual(
- paths.clusterConsumerGroupResetOffsetsPath(
- RouteParams.clusterName,
- RouteParams.consumerGroupID
- )
- );
- });
- it('clusterSchemasPath', () => {
- expect(paths.clusterSchemasPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/schemas`
- );
- expect(paths.clusterSchemasPath()).toEqual(
- paths.clusterSchemasPath(RouteParams.clusterName)
- );
- });
- it('clusterSchemaNewPath', () => {
- expect(paths.clusterSchemaNewPath(clusterName)).toEqual(
- `${paths.clusterSchemasPath(clusterName)}/create-new`
- );
- expect(paths.clusterSchemaNewPath()).toEqual(
- paths.clusterSchemaNewPath(RouteParams.clusterName)
- );
- });
- it('clusterSchemaPath', () => {
- expect(paths.clusterSchemaPath(clusterName, schemaId)).toEqual(
- `${paths.clusterSchemasPath(clusterName)}/${schemaId}`
- );
- expect(paths.clusterSchemaPath()).toEqual(
- paths.clusterSchemaPath(RouteParams.clusterName, RouteParams.subject)
- );
- });
- it('clusterSchemaEditPath', () => {
- expect(paths.clusterSchemaEditPath(clusterName, schemaId)).toEqual(
- `${paths.clusterSchemaPath(clusterName, schemaId)}/edit`
- );
- expect(paths.clusterSchemaEditPath()).toEqual(
- paths.clusterSchemaEditPath(RouteParams.clusterName, RouteParams.subject)
- );
- });
- it('clusterTopicsPath', () => {
- expect(paths.clusterTopicsPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/topics`
- );
- expect(paths.clusterTopicsPath()).toEqual(
- paths.clusterTopicsPath(RouteParams.clusterName)
- );
- });
- it('clusterTopicNewPath', () => {
- expect(paths.clusterTopicNewPath(clusterName)).toEqual(
- `${paths.clusterTopicsPath(clusterName)}/create-new`
- );
- expect(paths.clusterTopicNewPath()).toEqual(
- paths.clusterTopicNewPath(RouteParams.clusterName)
- );
- });
- it('clusterTopicPath', () => {
- expect(paths.clusterTopicPath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicsPath(clusterName)}/${topicId}`
- );
- expect(paths.clusterTopicPath()).toEqual(
- paths.clusterTopicPath(RouteParams.clusterName, RouteParams.topicName)
- );
- });
- it('clusterTopicSettingsPath', () => {
- expect(paths.clusterTopicSettingsPath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicPath(clusterName, topicId)}/settings`
- );
- expect(paths.clusterTopicSettingsPath()).toEqual(
- paths.clusterTopicSettingsPath(
- RouteParams.clusterName,
- RouteParams.topicName
- )
- );
- });
- it('clusterTopicConsumerGroupsPath', () => {
- expect(paths.clusterTopicConsumerGroupsPath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicPath(clusterName, topicId)}/consumer-groups`
- );
- expect(paths.clusterTopicConsumerGroupsPath()).toEqual(
- paths.clusterTopicConsumerGroupsPath(
- RouteParams.clusterName,
- RouteParams.topicName
- )
- );
- });
- it('clusterTopicMessagesPath', () => {
- expect(paths.clusterTopicMessagesPath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicPath(clusterName, topicId)}/messages`
- );
- expect(paths.clusterTopicMessagesPath()).toEqual(
- paths.clusterTopicMessagesPath(
- RouteParams.clusterName,
- RouteParams.topicName
- )
- );
- });
- it('clusterTopicSendMessagePath', () => {
- expect(paths.clusterTopicSendMessagePath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicPath(clusterName, topicId)}/message`
- );
- expect(paths.clusterTopicSendMessagePath()).toEqual(
- paths.clusterTopicSendMessagePath(
- RouteParams.clusterName,
- RouteParams.topicName
- )
- );
- });
- it('clusterTopicEditPath', () => {
- expect(paths.clusterTopicEditPath(clusterName, topicId)).toEqual(
- `${paths.clusterTopicPath(clusterName, topicId)}/edit`
- );
- expect(paths.clusterTopicEditPath()).toEqual(
- paths.clusterTopicEditPath(RouteParams.clusterName, RouteParams.topicName)
- );
- });
- it('clusterConnectsPath', () => {
- expect(paths.clusterConnectsPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/connects`
- );
- expect(paths.clusterConnectsPath()).toEqual(
- paths.clusterConnectsPath(RouteParams.clusterName)
- );
- });
- it('clusterConnectorsPath', () => {
- expect(paths.clusterConnectorsPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/connectors`
- );
- expect(paths.clusterConnectorsPath()).toEqual(
- paths.clusterConnectorsPath(RouteParams.clusterName)
- );
- });
- it('clusterConnectorNewPath', () => {
- expect(paths.clusterConnectorNewPath(clusterName)).toEqual(
- `${paths.clusterConnectorsPath(clusterName)}/create-new`
- );
- expect(paths.clusterConnectorNewPath()).toEqual(
- paths.clusterConnectorNewPath(RouteParams.clusterName)
- );
- });
- it('clusterConnectConnectorPath', () => {
- expect(
- paths.clusterConnectConnectorPath(clusterName, connectName, connectorName)
- ).toEqual(
- `${paths.clusterConnectsPath(
- clusterName
- )}/${connectName}/connectors/${connectorName}`
- );
- expect(paths.clusterConnectConnectorPath()).toEqual(
- paths.clusterConnectConnectorPath(
- RouteParams.clusterName,
- RouteParams.connectName,
- RouteParams.connectorName
- )
- );
- });
- it('clusterConnectConnectorsPath', () => {
- expect(
- paths.clusterConnectConnectorsPath(clusterName, connectName)
- ).toEqual(
- `${paths.clusterConnectsPath(clusterName)}/${connectName}/connectors`
- );
- expect(paths.clusterConnectConnectorsPath()).toEqual(
- paths.clusterConnectConnectorsPath(
- RouteParams.clusterName,
- RouteParams.connectName
- )
- );
- });
- it('clusterConnectConnectorEditPath', () => {
- expect(
- paths.clusterConnectConnectorEditPath(
- clusterName,
- connectName,
- connectorName
- )
- ).toEqual(
- `${paths.clusterConnectConnectorPath(
- clusterName,
- connectName,
- connectorName
- )}/edit`
- );
- expect(paths.clusterConnectConnectorEditPath()).toEqual(
- paths.clusterConnectConnectorEditPath(
- RouteParams.clusterName,
- RouteParams.connectName,
- RouteParams.connectorName
- )
- );
- });
- it('clusterConnectConnectorTasksPath', () => {
- expect(
- paths.clusterConnectConnectorTasksPath(
- clusterName,
- connectName,
- connectorName
- )
- ).toEqual(
- `${paths.clusterConnectConnectorPath(
- clusterName,
- connectName,
- connectorName
- )}/tasks`
- );
- expect(paths.clusterConnectConnectorTasksPath()).toEqual(
- paths.clusterConnectConnectorTasksPath(
- RouteParams.clusterName,
- RouteParams.connectName,
- RouteParams.connectorName
- )
- );
- });
- it('clusterConnectConnectorConfigPath', () => {
- expect(
- paths.clusterConnectConnectorConfigPath(
- clusterName,
- connectName,
- connectorName
- )
- ).toEqual(
- `${paths.clusterConnectConnectorPath(
- clusterName,
- connectName,
- connectorName
- )}/config`
- );
- expect(paths.clusterConnectConnectorConfigPath()).toEqual(
- paths.clusterConnectConnectorConfigPath(
- RouteParams.clusterName,
- RouteParams.connectName,
- RouteParams.connectorName
- )
- );
- });
- it('clusterKsqlDbPath', () => {
- expect(paths.clusterKsqlDbPath(clusterName)).toEqual(
- `${paths.clusterPath(clusterName)}/ksqldb`
- );
- expect(paths.clusterKsqlDbPath()).toEqual(
- paths.clusterKsqlDbPath(RouteParams.clusterName)
- );
- });
- it('clusterKsqlDbQueryPath', () => {
- expect(paths.clusterKsqlDbQueryPath(clusterName)).toEqual(
- `${paths.clusterKsqlDbPath(clusterName)}/query`
- );
- expect(paths.clusterKsqlDbQueryPath()).toEqual(
- paths.clusterKsqlDbQueryPath(RouteParams.clusterName)
- );
- });
- });
|