Skip to content

Commit ebf8a14

Browse files
committed
test(security_solution): fix failing tests for bulk adding alerts to chat
1 parent 874074c commit ebf8a14

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/results/attack_discovery_panel/tabs/alerts_tab/ease/table_bulk_add_to_chat.test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ jest.mock('@kbn/response-ops-alerts-table', () => ({
2323
AlertsTable: jest.fn(() => null),
2424
}));
2525
jest.mock('../../../../../../../agent_builder/hooks/use_report_add_to_chat');
26+
jest.mock('../../../../../../../agent_builder/hooks/use_agent_builder_availability', () => ({
27+
useAgentBuilderAvailability: jest.fn(() => ({
28+
isAgentBuilderEnabled: true,
29+
hasAgentBuilderPrivilege: true,
30+
isAgentChatExperienceEnabled: true,
31+
hasValidAgentBuilderLicense: false,
32+
})),
33+
}));
2634
jest.mock('../../../../../../../agent_builder/helpers', () => ({
2735
alertsToAttachmentGroup: jest.fn(() => []),
2836
}));
@@ -76,14 +84,14 @@ describe('Attack Discovery Table — bulkAddToChatConfig', () => {
7684
expect(initialMessage).toBe(BULK_ALERTS_ATTACHMENT_PROMPT);
7785
});
7886

79-
it('calls reportAddToChat with bulk_alerts_attack_discovery pathway and alert_count', () => {
87+
it('calls reportAddToChat with bulk_alerts_attack_discovery pathway and item_count', () => {
8088
const { convertAlertToAttachment } = renderAndGetBulkConfig();
8189
const items = [makeItem('a'), makeItem('b')];
8290
convertAlertToAttachment(items);
8391
expect(mockReportAddToChat).toHaveBeenCalledWith({
8492
pathway: 'bulk_alerts_attack_discovery',
8593
attachments: ['alert'],
86-
alert_count: 2,
94+
item_count: 2,
8795
});
8896
});
8997

x-pack/solutions/security/plugins/security_solution/public/cases/components/ease/table_bulk_add_to_chat.test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ jest.mock('@kbn/response-ops-alerts-table', () => ({
2323
AlertsTable: jest.fn(() => null),
2424
}));
2525
jest.mock('../../../agent_builder/hooks/use_report_add_to_chat');
26+
jest.mock('../../../agent_builder/hooks/use_agent_builder_availability', () => ({
27+
useAgentBuilderAvailability: jest.fn(() => ({
28+
isAgentBuilderEnabled: true,
29+
hasAgentBuilderPrivilege: true,
30+
isAgentChatExperienceEnabled: true,
31+
hasValidAgentBuilderLicense: false,
32+
})),
33+
}));
2634
jest.mock('../../../agent_builder/helpers', () => ({
2735
alertsToAttachmentGroup: jest.fn(() => []),
2836
}));
@@ -73,14 +81,14 @@ describe('Cases Table — bulkAddToChatConfig', () => {
7381
expect(initialMessage).toBe(BULK_ALERTS_ATTACHMENT_PROMPT);
7482
});
7583

76-
it('calls reportAddToChat with bulk_alerts_cases pathway and alert_count', () => {
84+
it('calls reportAddToChat with bulk_alerts_cases pathway and item_count', () => {
7785
const { convertAlertToAttachment } = renderAndGetBulkConfig();
7886
const items = [makeItem('a'), makeItem('b')];
7987
convertAlertToAttachment(items);
8088
expect(mockReportAddToChat).toHaveBeenCalledWith({
8189
pathway: 'bulk_alerts_cases',
8290
attachments: ['alert'],
83-
alert_count: 2,
91+
item_count: 2,
8492
});
8593
});
8694

0 commit comments

Comments
 (0)