Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,37 @@ describe('cliTexts', () => {
expect(screen.queryByTestId('user-pub-sub-link-disabled')).not.toBeInTheDocument()
})
})

describe('PSUBSCRIBE_COMMAND_CLI', () => {
it('should render proper content with flag disabled', async () => {
const initialStoreState = set(
cloneDeep(initialStateDefault),
`app.features.featureFlags.features.${FeatureFlags.envDependent}`,
{ flag: false }
)

render(cliTexts.PSUBSCRIBE_COMMAND(), {
store: mockStore(initialStoreState)
})

expect(screen.getByTestId('user-pub-sub-link-disabled')).toBeInTheDocument()
expect(screen.queryByTestId('user-pub-sub-link')).not.toBeInTheDocument()
})

it('should render proper content with flag enabled', () => {
const initialStoreState = set(
cloneDeep(initialStateDefault),
`app.features.featureFlags.features.${FeatureFlags.envDependent}`,
{ flag: true }
)

render(cliTexts.PSUBSCRIBE_COMMAND(), {
store: mockStore(initialStoreState)
})

expect(screen.getByTestId('user-pub-sub-link')).toBeInTheDocument()
expect(screen.queryByTestId('user-pub-sub-link-disabled')).not.toBeInTheDocument()
})
})
})
})
19 changes: 12 additions & 7 deletions redisinsight/ui/src/components/messages/cli-output/cliOutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,25 @@ export const cliTexts = {
REPEAT_COUNT_INVALID: 'Invalid repeat command option value',
CONNECTION_CLOSED: 'Client connection previously closed. Run the command after the connection is re-created.',
UNABLE_TO_DECRYPT: 'Unable to decrypt. Check the system keychain or re-run the command.',
PSUBSCRIBE_COMMAND: (path: string = '') => (
<EuiTextColor color="danger" key={Date.now()}>
PUB_SUB_NOT_SUPPORTED_ENV: (
<div className="cli-output-response-fail" data-testid="user-pub-sub-link-disabled">
PubSub not supported in this environment.
</div>
),
USE_PSUBSCRIBE_COMMAND: (path: string = '') => (
<EuiTextColor color="danger" key={Date.now()} data-testid="user-pub-sub-link">
{'Use '}
<EuiLink {...getRouterLinkProps(path)} color="text" data-test-subj="pubsub-page-btn">
Pub/Sub
</EuiLink>
{' to see the messages published to all channels in your database.'}
</EuiTextColor>
),
PSUBSCRIBE_COMMAND: (path: string = '') => (
<FeatureFlagComponent name={FeatureFlags.envDependent} otherwise={cliTexts.PUB_SUB_NOT_SUPPORTED_ENV}>
{cliTexts.USE_PSUBSCRIBE_COMMAND(path)}
</FeatureFlagComponent>
),
PSUBSCRIBE_COMMAND_CLI: (path: string = '') => (
[
cliTexts.PSUBSCRIBE_COMMAND(path),
Expand Down Expand Up @@ -92,11 +102,6 @@ export const cliTexts = {
{cliTexts.USE_PROFILER_TOOL(onClick)}
</FeatureFlagComponent>
),
PUB_SUB_NOT_SUPPORTED_ENV: (
<div className="cli-output-response-fail" data-testid="user-pub-sub-link-disabled">
PubSub not supported in this environment.
</div>
),
USE_PUB_SUB_TOOL: (path: string = '') => (
<EuiTextColor color="danger" key={Date.now()} data-testid="user-pub-sub-link">
{'Use '}
Expand Down
Loading