Skip to content

Commit 94c763b

Browse files
committed
#5852 - fix test
1 parent 49464de commit 94c763b

File tree

1 file changed

+14
-6
lines changed
  • redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat

1 file changed

+14
-6
lines changed

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/ExpertChat.spec.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
aiExpertChatSelector,
1616
clearExpertChatHistory,
1717
getExpertChatHistory,
18+
getExpertChatHistorySuccess,
1819
sendExpertQuestion,
1920
updateExpertChatAgreements,
2021
} from 'uiSrc/slices/panels/aiAssistant'
@@ -57,13 +58,18 @@ jest.mock('react-router-dom', () => ({
5758
}))
5859

5960
let store: typeof mockedStore
60-
beforeEach(() => {
61-
cleanup()
62-
store = cloneDeep(mockedStoreFn())
63-
store.clearActions()
64-
})
6561

6662
describe('ExpertChat', () => {
63+
beforeEach(() => {
64+
cleanup()
65+
store = cloneDeep(mockedStoreFn())
66+
// store.clearActions()
67+
})
68+
69+
afterEach(() => {
70+
console.log(store.getActions())
71+
})
72+
6773
it('should render', () => {
6874
expect(render(<ExpertChat />, { store })).toBeTruthy()
6975
})
@@ -200,7 +206,8 @@ describe('ExpertChat', () => {
200206
it('should call action after click on restart session', async () => {
201207
const sendEventTelemetryMock = jest.fn();
202208
(sendEventTelemetry as jest.Mock).mockImplementation(() => sendEventTelemetryMock)
203-
apiService.delete = jest.fn().mockResolvedValueOnce({ status: 200 });
209+
apiService.delete = jest.fn().mockResolvedValueOnce({ status: 200 })
210+
apiService.get = jest.fn().mockResolvedValueOnce({ status: 200 });
204211

205212
(aiExpertChatSelector as jest.Mock).mockReturnValue({
206213
loading: false,
@@ -221,6 +228,7 @@ describe('ExpertChat', () => {
221228

222229
expect(store.getActions()).toEqual([
223230
...afterRenderActions,
231+
getExpertChatHistorySuccess(),
224232
clearExpertChatHistory()
225233
])
226234

0 commit comments

Comments
 (0)