diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts index ac281a4563432..d90c8ea49a53f 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts @@ -293,17 +293,20 @@ export const getCreateRequest = () => body: typicalPayload(), }); -export const createMlRuleRequest = () => - requestMock.create({ +export const createMlRuleRequest = () => { + const { query, language, index, ...mlParams } = typicalPayload(); + + return requestMock.create({ method: 'post', path: DETECTION_ENGINE_RULES_URL, body: { - ...typicalPayload(), + ...mlParams, type: 'machine_learning', anomaly_threshold: 50, machine_learning_job_id: 'some-uuid', }, }); +}; export const getSetSignalStatusByIdsRequest = () => requestMock.create({ diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/create_rules_route.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/create_rules_route.test.ts index 0ae09c5cb1661..976f371c6b1a6 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/create_rules_route.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/create_rules_route.test.ts @@ -50,7 +50,7 @@ describe('create_rules', () => { }); describe('creating an ML Rule', () => { - it('works', async () => { + it('is successful', async () => { const response = await server.inject(createMlRuleRequest(), context); expect(response.status).toEqual(200); });