Skip to content

Commit 7bcd750

Browse files
authored
Merge pull request #1510 from RedisInsight/fe/bugfix/RI-3930
#RI-3930 - fix text for scan
2 parents 2e41e8a + 6124354 commit 7bcd750

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

redisinsight/ui/src/components/keys-summary/KeysSummary.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ describe('KeysSummary', () => {
2424
expect(queryByTestId('keys-summary')).toBeInTheDocument()
2525
})
2626

27+
it('should Keys summary show proper text with count = 1', () => {
28+
const { queryByTestId } = render(
29+
<KeysSummary {...instance(mockedProps)} scanned={1} items={[{}]} totalItemsCount={1} />
30+
)
31+
expect(queryByTestId('keys-summary')).toHaveTextContent('Results: 1 key.')
32+
})
33+
34+
it('should Keys summary show proper text with count > 1', () => {
35+
const { queryByTestId } = render(
36+
<KeysSummary {...instance(mockedProps)} scanned={2} items={[{}, {}]} totalItemsCount={2} />
37+
)
38+
expect(queryByTestId('keys-summary')).toHaveTextContent('Results: 2 keys.')
39+
})
40+
2741
it('should not render Scan more button if showScanMore = false ', () => {
2842
const { queryByTestId } = render(
2943
<KeysSummary {...instance(mockedProps)} showScanMore={false} />

redisinsight/ui/src/components/keys-summary/KeysSummary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const KeysSummary = (props: Props) => {
4747
<b>
4848
{'Results: '}
4949
<span data-testid="keys-number-of-results">{numberWithSpaces(resultsLength)}</span>
50-
{` key${resultsLength !== 1 && 's'}. `}
50+
{` key${resultsLength !== 1 ? 's' : ''}. `}
5151
</b>
5252
<EuiTextColor color="subdued">
5353
{'Scanned '}

0 commit comments

Comments
 (0)