Skip to content

Commit 6e7f6dc

Browse files
#RI-2509-fix unit test
1 parent 29ef589 commit 6e7f6dc

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

redisinsight/api/src/modules/workbench/providers/command-execution.provider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('CommandExecutionProvider', () => {
141141
]));
142142
});
143143
it('should return with flag isNotStored="true" even if size limit exceeded', async () => {
144-
repository.save.mockReturnValueOnce([mockCommandExecutionEntity]);
144+
repository.save.mockReturnValueOnce([{ ...mockCommandExecutionEntity, isNotStored: true }]);
145145
encryptionService.encrypt.mockReturnValue(mockEncryptResult);
146146

147147
const executionResult = [new CommandExecutionResult({

redisinsight/ui/src/utils/tests/cliHelper.spec.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
getDbIndexFromSelectQuery,
33
getCommandNameFromQuery,
44
cliParseCommandsGroupResult,
5+
CliPrefix
56
} from 'uiSrc/utils'
67
import { MOCK_COMMANDS_SPEC } from 'uiSrc/constants'
78
import { render, screen } from 'uiSrc/utils/test-utils'
@@ -65,7 +66,18 @@ describe('cliParseCommandsGroupResult', () => {
6566
render(cliParseCommandsGroupResult(mockResult, mockIndex))
6667

6768
expect(screen.queryByTestId('wb-command')).toBeInTheDocument()
68-
expect(screen.queryByTestId('wb-command-result')).toBeInTheDocument()
6969
expect(screen.getByText('> command')).toBeInTheDocument()
70-
expect(screen.getByText('response')).toBeInTheDocument()
70+
expect(screen.queryByTestId(`${CliPrefix.Cli}-output-response-success`)).toBeInTheDocument()
71+
})
72+
73+
describe('cliParseCommandsGroupResult error status', () => {
74+
const mockResult = {
75+
command: 'command',
76+
response: 'response',
77+
status: 'fail'
78+
}
79+
const mockIndex = 1
80+
render(cliParseCommandsGroupResult(mockResult, mockIndex))
81+
82+
expect(screen.queryByTestId(`${CliPrefix.Cli}-output-response-fail`)).toBeInTheDocument()
7183
})

0 commit comments

Comments
 (0)