Skip to content

Commit 7cbd2bf

Browse files
author
Alyar
committed
Fix jest tests
1 parent b531f8c commit 7cbd2bf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/__tests__/ai_assistant_controller.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,13 @@ describe('AIAssistantController', () => {
7777
});
7878

7979
describe('getMessageDataSource', () => {
80-
it('should return dataSource with store and reshapeOnPush', () => {
80+
it('should return dataSource with store', () => {
8181
const controller = createController();
8282
const dataSource = controller.getMessageDataSource() as {
8383
store: ArrayStore<Message, string>;
84-
reshapeOnPush: boolean;
8584
};
8685

8786
expect(dataSource.store).toBeDefined();
88-
expect(dataSource.reshapeOnPush).toBe(true);
8987
});
9088
});
9189

@@ -111,7 +109,7 @@ describe('AIAssistantController', () => {
111109
id: expect.stringContaining(AI_ASSISTANT_AUTHOR_ID),
112110
timestamp: expectedTimestamp,
113111
author: AI_ASSISTANT_AUTHOR,
114-
text: 'Generate values',
112+
text: 'Request in progress',
115113
status: MessageStatus.Pending,
116114
}),
117115
]);
@@ -176,6 +174,7 @@ describe('AIAssistantController', () => {
176174
text: 'Generate values',
177175
timestamp: '2026-04-16T10:00:00.000Z',
178176
} as Message);
177+
promise.catch(() => {});
179178

180179
sendRequestCallbacks.onError?.(new Error('Network error'));
181180

@@ -184,7 +183,8 @@ describe('AIAssistantController', () => {
184183
expect(messages).toEqual([
185184
expect.objectContaining({
186185
status: MessageStatus.Failure,
187-
text: 'Network error',
186+
text: 'Failed to process request',
187+
errorText: 'Network error',
188188
}),
189189
]);
190190

@@ -201,6 +201,7 @@ describe('AIAssistantController', () => {
201201
text: 'Generate values',
202202
timestamp: '2026-04-16T10:00:00.000Z',
203203
} as Message);
204+
promise.catch(() => {});
204205

205206
const response = {} as ExecuteGridAssistantCommandResult;
206207

@@ -213,7 +214,8 @@ describe('AIAssistantController', () => {
213214
expect(messages).toEqual([
214215
expect.objectContaining({
215216
status: MessageStatus.Failure,
216-
text: 'Default error message',
217+
text: 'Failed to process request',
218+
errorText: 'Default error message',
217219
}),
218220
]);
219221

0 commit comments

Comments
 (0)