-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2520299
commit 33b00f6
Showing
15 changed files
with
601 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,31 +4,105 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { SortFieldCase } from '../../../../../containers/case/types'; | ||
import { UseGetCasesState } from '../../../../../containers/case/use_get_cases'; | ||
import { CaseProps } from '../case_view'; | ||
import { Case, Comment, SortFieldCase } from '../../../../containers/case/types'; | ||
import { UseGetCasesState } from '../../../../containers/case/use_get_cases'; | ||
import { UserAction, UserActionField } from '../../../../../../../../plugins/case/common/api/cases'; | ||
|
||
const updateCase = jest.fn(); | ||
const fetchCase = jest.fn(); | ||
|
||
const basicCaseId = 'basic-case-id'; | ||
const basicCommentId = 'basic-comment-id'; | ||
const basicCreatedAt = '2020-02-20T23:06:33.798Z'; | ||
const elasticUser = { | ||
fullName: 'Leslie Knope', | ||
username: 'lknope', | ||
email: '[email protected]', | ||
}; | ||
|
||
export const basicComment: Comment = { | ||
comment: 'Solve this fast!', | ||
id: basicCommentId, | ||
createdAt: basicCreatedAt, | ||
createdBy: elasticUser, | ||
pushedAt: null, | ||
pushedBy: null, | ||
updatedAt: '2020-02-20T23:06:33.798Z', | ||
updatedBy: { | ||
username: 'elastic', | ||
}, | ||
version: 'WzQ3LDFc', | ||
}; | ||
|
||
export const basicCase: Case = { | ||
closedAt: null, | ||
closedBy: null, | ||
id: basicCaseId, | ||
comments: [basicComment], | ||
createdAt: '2020-02-13T19:44:23.627Z', | ||
createdBy: elasticUser, | ||
description: 'Security banana Issue', | ||
externalService: null, | ||
status: 'open', | ||
tags: ['defacement'], | ||
title: 'Another horrible breach!!', | ||
totalComment: 1, | ||
updatedAt: '2020-02-19T15:02:57.995Z', | ||
updatedBy: { | ||
username: 'elastic', | ||
}, | ||
version: 'WzQ3LDFd', | ||
}; | ||
|
||
export const caseProps: CaseProps = { | ||
caseId: basicCaseId, | ||
userCanCrud: true, | ||
caseData: basicCase, | ||
fetchCase, | ||
updateCase, | ||
}; | ||
|
||
export const caseClosedProps: CaseProps = { | ||
...caseProps, | ||
caseData: { | ||
...caseProps.caseData, | ||
closedAt: '2020-02-20T23:06:33.798Z', | ||
closedBy: { | ||
username: 'elastic', | ||
}, | ||
status: 'closed', | ||
}, | ||
}; | ||
|
||
export const basicCaseClosed: Case = { | ||
...caseClosedProps.caseData, | ||
}; | ||
|
||
const basicAction = { | ||
actionAt: basicCreatedAt, | ||
actionBy: elasticUser, | ||
oldValue: null, | ||
newValue: 'what a cool value', | ||
caseId: basicCaseId, | ||
commentId: null, | ||
}; | ||
export const caseUserActions = [ | ||
{ | ||
...basicAction, | ||
actionBy: elasticUser, | ||
actionField: ['comment'], | ||
action: 'create', | ||
actionId: 'tt', | ||
}, | ||
]; | ||
|
||
export const useGetCasesMockState: UseGetCasesState = { | ||
data: { | ||
countClosedCases: 0, | ||
countOpenCases: 5, | ||
cases: [ | ||
{ | ||
closedAt: null, | ||
closedBy: null, | ||
id: '3c4ddcc0-4e99-11ea-9290-35d05cb55c15', | ||
createdAt: '2020-02-13T19:44:23.627Z', | ||
createdBy: { username: 'elastic' }, | ||
comments: [], | ||
description: 'Security banana Issue', | ||
externalService: null, | ||
status: 'open', | ||
tags: ['defacement'], | ||
title: 'Another horrible breach', | ||
totalComment: 0, | ||
updatedAt: null, | ||
updatedBy: null, | ||
version: 'WzQ3LDFd', | ||
}, | ||
basicCase, | ||
{ | ||
closedAt: null, | ||
closedBy: null, | ||
|
@@ -129,3 +203,24 @@ export const useGetCasesMockState: UseGetCasesState = { | |
}, | ||
filterOptions: { search: '', reporters: [], tags: [], status: 'open' }, | ||
}; | ||
|
||
const basicPush = { | ||
connector_id: 'connector_id', | ||
connector_name: 'connector name', | ||
external_id: 'external_id', | ||
external_title: 'external title', | ||
external_url: 'basicPush.com', | ||
pushed_at: basicCreatedAt, | ||
pushed_by: elasticUser, | ||
}; | ||
export const getUserAction = (af: UserActionField, a: UserAction) => ({ | ||
...basicAction, | ||
actionId: `${af[0]}-${a}`, | ||
actionField: af, | ||
action: a, | ||
commentId: af[0] === 'comment' ? basicCommentId : null, | ||
newValue: | ||
a === 'push-to-service' && af[0] === 'pushed' | ||
? JSON.stringify(basicPush) | ||
: basicAction.newValue, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 0 additions & 93 deletions
93
x-pack/legacy/plugins/siem/public/pages/case/components/case_view/__mock__/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.