Skip to content

Commit 2e83394

Browse files
DataGrid - AI Assistant: Implement GridCommands class (DevExpress#33460)
Co-authored-by: anna.shakhova <anna.shakhova@devexpress.com>
1 parent 9a291f0 commit 2e83394

44 files changed

Lines changed: 1432 additions & 29 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

e2e/wrappers/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"tslib": "^2.3.0",
5050
"vue": "^3.5.13",
5151
"vue-router": "^4.3.0",
52+
"zod": "3.24.4",
53+
"zod-to-json-schema": "3.24.6",
5254
"zone.js": "~0.15.0"
5355
},
5456
"devDependencies": {

packages/devextreme/js/__internal/core/ai_integration/commands/executeGridAssistant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class ExecuteGridAssistantCommand extends BaseCommand<
2323
};
2424
}
2525

26+
// TODO: check response more carefully
2627
protected parseResult(
2728
response: ExecuteGridAssistantCommandResponse,
2829
): ExecuteGridAssistantCommandResult {

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ import {
1616
AI_ASSISTANT_AUTHOR_ID,
1717
MessageStatus,
1818
} from '../const';
19+
import { GridCommands } from '../grid_commands';
20+
import type { CommandResult } from '../types';
21+
22+
jest.mock('../grid_commands');
23+
24+
const MockedGridCommands = GridCommands as jest.MockedClass<typeof GridCommands>;
1925

2026
let sendRequestCallbacks: RequestCallbacks<ExecuteGridAssistantCommandResult> = {};
2127

@@ -59,6 +65,15 @@ const getStore = (controller: AIAssistantController): ArrayStore<Message, string
5965
describe('AIAssistantController', () => {
6066
beforeEach(() => {
6167
jest.clearAllMocks();
68+
69+
// TODO: Rework the tests using updated GridCommands implementation
70+
(MockedGridCommands.mockImplementation as jest.Mock).call(
71+
MockedGridCommands,
72+
() => ({
73+
validate: jest.fn().mockReturnValue(true),
74+
executeCommands: jest.fn<() => Promise<CommandResult[]>>().mockResolvedValue([{ status: 'success', message: 'sort' }]),
75+
}),
76+
);
6277
});
6378

6479
describe('getMessageDataSource', () => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
beforeTest,
2222
createDataGrid,
2323
} from '../../__tests__/__mock__/helpers/utils';
24-
import { AIAssistantIntegrationController } from '../m_ai_assistant_integration_controller';
24+
import { AIAssistantIntegrationController } from '../ai_assistant_integration_controller';
2525

2626
interface SendRequestResult {
2727
promise: Promise<string>;

0 commit comments

Comments
 (0)