Skip to content

Commit

Permalink
Fix router test for creating an ML rule
Browse files Browse the repository at this point in the history
We were sending invalid parameters.
  • Loading branch information
rylnd committed Mar 18, 2020
1 parent 1aa4321 commit 8ff01e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 8ff01e9

Please sign in to comment.