Skip to content

Commit

Permalink
adds unit test to reflect change
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 committed Feb 6, 2020
1 parent 796d704 commit 1a12d92
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,18 @@ describe('create_rules_bulk', () => {
expect(statusCode).toBe(400);
});
});

test('returns 409 if duplicate rule_ids found in request payload', async () => {
alertsClient.find.mockResolvedValue(getFindResult());
alertsClient.get.mockResolvedValue(getResult());
actionsClient.create.mockResolvedValue(createActionResult());
alertsClient.create.mockResolvedValue(getResult());
const request: ServerInjectOptions = {
method: 'POST',
url: `${DETECTION_ENGINE_RULES_URL}/_bulk_create`,
payload: [typicalPayload(), typicalPayload()],
};
const { payload } = await server.inject(request);
expect(JSON.parse(payload).error.status_code).toBe(409);
});
});

0 comments on commit 1a12d92

Please sign in to comment.