diff --git a/x-pack/plugins/task_manager/server/integration_tests/__snapshots__/task_cost_check.test.ts.snap b/x-pack/plugins/task_manager/server/integration_tests/__snapshots__/task_cost_check.test.ts.snap index 96ac62b9f03df..d808fab832d6c 100644 --- a/x-pack/plugins/task_manager/server/integration_tests/__snapshots__/task_cost_check.test.ts.snap +++ b/x-pack/plugins/task_manager/server/integration_tests/__snapshots__/task_cost_check.test.ts.snap @@ -4,119 +4,119 @@ exports[`Task cost checks detects tasks with cost definitions 1`] = ` Array [ Object { "cost": 1, - "taskType": "actions:.email", + "taskType": "actions:.bedrock", }, Object { "cost": 1, - "taskType": "actions:.index", + "taskType": "actions:.cases", }, Object { "cost": 1, - "taskType": "actions:.pagerduty", + "taskType": "actions:.cases-webhook", }, Object { "cost": 1, - "taskType": "actions:.swimlane", + "taskType": "actions:.crowdstrike", }, Object { "cost": 1, - "taskType": "actions:.server-log", + "taskType": "actions:.d3security", }, Object { "cost": 1, - "taskType": "actions:.slack", + "taskType": "actions:.email", }, Object { "cost": 1, - "taskType": "actions:.slack_api", + "taskType": "actions:.gemini", }, Object { "cost": 1, - "taskType": "actions:.webhook", + "taskType": "actions:.gen-ai", }, Object { "cost": 1, - "taskType": "actions:.cases-webhook", + "taskType": "actions:.index", }, Object { "cost": 1, - "taskType": "actions:.xmatters", + "taskType": "actions:.inference", }, Object { "cost": 1, - "taskType": "actions:.servicenow", + "taskType": "actions:.jira", }, Object { "cost": 1, - "taskType": "actions:.servicenow-sir", + "taskType": "actions:.observability-ai-assistant", }, Object { "cost": 1, - "taskType": "actions:.servicenow-itom", + "taskType": "actions:.opsgenie", }, Object { "cost": 1, - "taskType": "actions:.jira", + "taskType": "actions:.pagerduty", }, Object { "cost": 1, - "taskType": "actions:.teams", + "taskType": "actions:.resilient", }, Object { "cost": 1, - "taskType": "actions:.torq", + "taskType": "actions:.sentinelone", }, Object { "cost": 1, - "taskType": "actions:.opsgenie", + "taskType": "actions:.server-log", }, Object { "cost": 1, - "taskType": "actions:.tines", + "taskType": "actions:.servicenow", }, Object { "cost": 1, - "taskType": "actions:.gen-ai", + "taskType": "actions:.servicenow-itom", }, Object { "cost": 1, - "taskType": "actions:.bedrock", + "taskType": "actions:.servicenow-sir", }, Object { "cost": 1, - "taskType": "actions:.gemini", + "taskType": "actions:.slack", }, Object { "cost": 1, - "taskType": "actions:.d3security", + "taskType": "actions:.slack_api", }, Object { "cost": 1, - "taskType": "actions:.resilient", + "taskType": "actions:.swimlane", }, Object { "cost": 1, - "taskType": "actions:.thehive", + "taskType": "actions:.teams", }, Object { "cost": 1, - "taskType": "actions:.sentinelone", + "taskType": "actions:.thehive", }, Object { "cost": 1, - "taskType": "actions:.crowdstrike", + "taskType": "actions:.tines", }, Object { "cost": 1, - "taskType": "actions:.inference", + "taskType": "actions:.torq", }, Object { "cost": 1, - "taskType": "actions:.cases", + "taskType": "actions:.webhook", }, Object { "cost": 1, - "taskType": "actions:.observability-ai-assistant", + "taskType": "actions:.xmatters", }, Object { "cost": 10, diff --git a/x-pack/plugins/task_manager/server/integration_tests/task_cost_check.test.ts b/x-pack/plugins/task_manager/server/integration_tests/task_cost_check.test.ts index 96678f714ac69..df11792b2c4ad 100644 --- a/x-pack/plugins/task_manager/server/integration_tests/task_cost_check.test.ts +++ b/x-pack/plugins/task_manager/server/integration_tests/task_cost_check.test.ts @@ -12,6 +12,7 @@ import { import { TaskCost, TaskDefinition } from '../task'; import { setupTestServers } from './lib'; import { TaskTypeDictionary } from '../task_type_dictionary'; +import { sortBy } from 'lodash'; jest.mock('../task_type_dictionary', () => { const actual = jest.requireActual('../task_type_dictionary'); @@ -50,14 +51,17 @@ describe('Task cost checks', () => { it('detects tasks with cost definitions', async () => { const taskTypes = taskTypeDictionary.getAllDefinitions(); - const taskTypesWithCost = taskTypes - .map((taskType: TaskDefinition) => - !!taskType.cost ? { taskType: taskType.type, cost: taskType.cost } : null - ) - .filter( - (tt: { taskType: string; cost: TaskCost } | null) => - null != tt && tt.cost !== TaskCost.Normal - ); + const taskTypesWithCost = sortBy( + taskTypes + .map((taskType: TaskDefinition) => + !!taskType.cost ? { taskType: taskType.type, cost: taskType.cost } : null + ) + .filter( + (tt: { taskType: string; cost: TaskCost } | null) => + null != tt && tt.cost !== TaskCost.Normal + ), + 'taskType' + ); expect(taskTypesWithCost).toMatchSnapshot(); }); });