AI Assistant: error handling integration tests#33666
Open
dmirgaev wants to merge 10 commits into
Open
Conversation
3441527 to
6ae8ed0
Compare
6ae8ed0 to
f839f16
Compare
Alyar666
previously approved these changes
May 22, 2026
Comment on lines
+1
to
+6
| import type DataGrid from '@js/ui/data_grid'; | ||
| import type { Controllers } from '@ts/grids/grid_core/m_types'; | ||
|
|
||
| export interface DataGridWithControllers extends DataGrid { | ||
| getController: <T extends keyof Controllers>(name: T) => Controllers[T]; | ||
| } |
| if ($message.hasClass(CLASSES.messageError)) { | ||
| return MessageStatus.Failure; | ||
| } | ||
| return '' as never; |
Comment on lines
+288
to
+307
| const { model, getLastCallbacks } = await createDataGridWithAiAndPopup(); | ||
|
|
||
| model.sendAiRequest('Sort by name'); | ||
| jest.runAllTimers(); | ||
|
|
||
| const actions = [{ name: 'sort', args: { column: 'Name' } }]; | ||
| getLastCallbacks().onComplete?.({ actions }); | ||
| await flushAsync(); | ||
| await flushAsync(); | ||
|
|
||
| const messages = await model.loadMessages(); | ||
|
|
||
| expect(messages).toEqual([ | ||
| expect.objectContaining({ | ||
| status: MessageStatus.Failure, | ||
| errorText: 'Execution already in progress. Please wait.', | ||
| }), | ||
| ]); | ||
|
|
||
| isExecutingSpy.mockRestore(); |
Comment on lines
+74
to
+88
| const createDataGridWithAi = async ( | ||
| overrides: Record<string, unknown> = {}, | ||
| ): Promise<{ | ||
| model: AIAssistantDataGridModel; | ||
| getLastCallbacks: () => RequestCallbacks<ExecuteGridAssistantCommandResult>; | ||
| getAbortSpy: () => jest.Mock; | ||
| }> => { | ||
| const { aiIntegration, getLastCallbacks, getAbortSpy } = createMockAIIntegration(); | ||
|
|
||
| await createDataGrid({ | ||
| dataSource: LOCAL_DATA, | ||
| columns: DEFAULT_COLUMNS, | ||
| aiAssistant: { enabled: true, aiIntegration, title: 'AI Assistant' }, | ||
| ...overrides, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.