Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Apr 23, 2021
1 parent 4d6fbe7 commit 85fbd91
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Case Configuration API', () => {
await postCaseConfigure(caseConfigurationMock, abortCtrl.signal);
expect(fetchMock).toHaveBeenCalledWith('/api/cases/configure', {
body:
'{"connector":{"id":"123","name":"My connector","type":".jira","fields":null},"closure_type":"close-by-user"}',
'{"connector":{"id":"123","name":"My connector","type":".jira","fields":null},"owner":"securitySolution","closure_type":"close-by-user"}',
method: 'POST',
signal: abortCtrl.signal,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const caseConfigurationMock: CasesConfigureRequest = {
};

export const caseConfigurationCamelCaseResponseMock: CaseConfigure = {
id: '123',
createdAt: '2020-04-06T13:03:18.657Z',
createdBy: { username: 'elastic', fullName: 'Elastic', email: 'elastic@elastic.co' },
connector: {
Expand All @@ -160,4 +161,5 @@ export const caseConfigurationCamelCaseResponseMock: CaseConfigure = {
updatedAt: '2020-04-06T14:03:18.657Z',
updatedBy: { username: 'elastic', fullName: 'Elastic', email: 'elastic@elastic.co' },
version: 'WzHJ12',
owner: 'securitySolution',
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface CaseConnectorMapping {
}

export interface CaseConfigure {
id: string;
closureType: ClosureType;
connector: CasesConfigure['connector'];
createdAt: string;
Expand All @@ -43,4 +44,5 @@ export interface CaseConfigure {
updatedAt: string;
updatedBy: ElasticUser;
version: string;
owner: string;
}
15 changes: 15 additions & 0 deletions x-pack/test/case_api_integration/common/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,3 +876,18 @@ export const getReporters = async ({

return res;
};

export const pushCase = async (
supertest: st.SuperTest<supertestAsPromised.Test>,
caseId: string,
connectorId: string,
expectedHttpCode: number = 200
): Promise<CaseResponse> => {
const { body: res } = await supertest
.post(`${CASES_URL}/${caseId}/connector/${connectorId}/_push`)
.set('kbn-xsrf', 'true')
.send({})
.expect(expectedHttpCode);

return res;
};

0 comments on commit 85fbd91

Please sign in to comment.