Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Apr 23, 2021
1 parent dbbc2f3 commit 62d4f1c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 2 additions & 4 deletions x-pack/plugins/cases/common/api/cases/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ export const AllTagsFindRequestRt = rt.partial({
owner: rt.union([rt.array(rt.string), rt.string]),
});

export const AllReportersFindRequestRt = rt.partial({
owner: rt.union([rt.array(rt.string), rt.string]),
});
export const AllReportersFindRequestRt = AllTagsFindRequestRt;

export type CaseAttributes = rt.TypeOf<typeof CaseAttributesRt>;
/**
Expand All @@ -208,4 +206,4 @@ export type ESCasePatchRequest = Omit<CasePatchRequest, 'connector'> & {
};

export type AllTagsFindRequest = rt.TypeOf<typeof AllTagsFindRequestRt>;
export type AllReportersFindRequest = rt.TypeOf<typeof AllReportersFindRequestRt>;
export type AllReportersFindRequest = AllTagsFindRequest;
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ export const mockCaseConfigure: Array<SavedObject<ESCasesConfigureAttributes>> =
email: 'testemail@elastic.co',
username: 'elastic',
},
owner: 'securitySolution',
},
references: [],
updated_at: '2020-04-09T09:43:51.778Z',
Expand All @@ -484,6 +485,7 @@ export const mockCaseMappings: Array<SavedObject<ConnectorMappings>> = [
id: 'mock-mappings-1',
attributes: {
mappings: mappings[ConnectorTypes.jira],
owner: 'securitySolution',
},
references: [],
},
Expand Down
6 changes: 5 additions & 1 deletion x-pack/plugins/cases/server/services/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export const createConfigureServiceMock = (): CaseConfigureServiceMock => {
};

export const connectorMappingsServiceMock = (): ConnectorMappingsServiceMock => {
const service: PublicMethodsOf<ConnectorMappingsService> = { find: jest.fn(), post: jest.fn() };
const service: PublicMethodsOf<ConnectorMappingsService> = {
find: jest.fn(),
post: jest.fn(),
update: jest.fn(),
};

// the cast here is required because jest.Mocked tries to include private members and would throw an error
return (service as unknown) as ConnectorMappingsServiceMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const actionTypesMock: ActionTypeConnector[] = [
];

export const caseConfigurationResposeMock: CasesConfigureResponse = {
id: '123',
created_at: '2020-04-06T13:03:18.657Z',
created_by: { username: 'elastic', full_name: 'Elastic', email: 'elastic@elastic.co' },
connector: {
Expand All @@ -129,6 +130,7 @@ export const caseConfigurationResposeMock: CasesConfigureResponse = {
mappings: [],
updated_at: '2020-04-06T14:03:18.657Z',
updated_by: { username: 'elastic', full_name: 'Elastic', email: 'elastic@elastic.co' },
owner: 'securitySolution',
version: 'WzHJ12',
};

Expand All @@ -139,6 +141,7 @@ export const caseConfigurationMock: CasesConfigureRequest = {
type: ConnectorTypes.jira,
fields: null,
},
owner: 'securitySolution',
closure_type: 'close-by-user',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ export const useCaseConfigure = (): ReturnUseCaseConfigure => {
const connectorObj = {
connector,
closure_type: closureType,
// TODO: use constant after https://github.com/elastic/kibana/pull/97646 is being merged
owner: 'securitySolution',
};

const res =
Expand Down

0 comments on commit 62d4f1c

Please sign in to comment.