-
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.
Merge branch 'master' of github.com:elastic/kibana into move-alerts-t…
…o-siem
- Loading branch information
Showing
11 changed files
with
401 additions
and
741 deletions.
There are no files selected for viewing
605 changes: 0 additions & 605 deletions
605
x-pack/plugins/endpoint/public/embeddables/resolver/view/process_event_dot.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
118 changes: 59 additions & 59 deletions
118
x-pack/plugins/siem/public/resolver/store/data/selectors.test.ts
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 |
---|---|---|
@@ -1,59 +1,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Store, createStore } from 'redux'; | ||
import { DataAction } from './action'; | ||
import { dataReducer } from './reducer'; | ||
import { | ||
DataState, | ||
RelatedEventDataEntry, | ||
RelatedEventDataEntryWithStats, | ||
RelatedEventData, | ||
} from '../../types'; | ||
import { ResolverEvent } from '../../../../../common/types'; | ||
import { relatedEventStats, relatedEvents } from './selectors'; | ||
|
||
describe('resolver data selectors', () => { | ||
const store: Store<DataState, DataAction> = createStore(dataReducer, undefined); | ||
describe('when related event data is reduced into state with no results', () => { | ||
let relatedEventInfoBeforeAction: RelatedEventData; | ||
beforeEach(() => { | ||
relatedEventInfoBeforeAction = new Map(relatedEvents(store.getState()) || []); | ||
const payload: Map<ResolverEvent, RelatedEventDataEntry> = new Map(); | ||
const action: DataAction = { type: 'serverReturnedRelatedEventData', payload }; | ||
store.dispatch(action); | ||
}); | ||
it('should have the same related info as before the action', () => { | ||
const relatedInfoAfterAction = relatedEvents(store.getState()); | ||
expect(relatedInfoAfterAction).toEqual(relatedEventInfoBeforeAction); | ||
}); | ||
}); | ||
describe('when related event data is reduced into state with 2 dns results', () => { | ||
let mockBaseEvent: ResolverEvent; | ||
beforeEach(() => { | ||
mockBaseEvent = {} as ResolverEvent; | ||
function dnsRelatedEventEntry() { | ||
const fakeEvent = {} as ResolverEvent; | ||
return { relatedEvent: fakeEvent, relatedEventType: 'dns' }; | ||
} | ||
const payload: Map<ResolverEvent, RelatedEventDataEntry> = new Map([ | ||
[ | ||
mockBaseEvent, | ||
{ | ||
relatedEvents: [dnsRelatedEventEntry(), dnsRelatedEventEntry()], | ||
}, | ||
], | ||
]); | ||
const action: DataAction = { type: 'serverReturnedRelatedEventData', payload }; | ||
store.dispatch(action); | ||
}); | ||
it('should compile stats reflecting a count of 2 for dns', () => { | ||
const actualStats = relatedEventStats(store.getState()); | ||
const statsForFakeEvent = actualStats.get(mockBaseEvent)! as RelatedEventDataEntryWithStats; | ||
expect(statsForFakeEvent.stats).toEqual({ dns: 2 }); | ||
}); | ||
}); | ||
}); | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Store, createStore } from 'redux'; | ||
import { DataAction } from './action'; | ||
import { dataReducer } from './reducer'; | ||
import { | ||
DataState, | ||
RelatedEventDataEntry, | ||
RelatedEventDataEntryWithStats, | ||
RelatedEventData, | ||
} from '../../types'; | ||
import { ResolverEvent } from '../../../../common/endpoint/types'; | ||
import { relatedEventStats, relatedEvents } from './selectors'; | ||
|
||
describe('resolver data selectors', () => { | ||
const store: Store<DataState, DataAction> = createStore(dataReducer, undefined); | ||
describe('when related event data is reduced into state with no results', () => { | ||
let relatedEventInfoBeforeAction: RelatedEventData; | ||
beforeEach(() => { | ||
relatedEventInfoBeforeAction = new Map(relatedEvents(store.getState()) || []); | ||
const payload: Map<ResolverEvent, RelatedEventDataEntry> = new Map(); | ||
const action: DataAction = { type: 'serverReturnedRelatedEventData', payload }; | ||
store.dispatch(action); | ||
}); | ||
it('should have the same related info as before the action', () => { | ||
const relatedInfoAfterAction = relatedEvents(store.getState()); | ||
expect(relatedInfoAfterAction).toEqual(relatedEventInfoBeforeAction); | ||
}); | ||
}); | ||
describe('when related event data is reduced into state with 2 dns results', () => { | ||
let mockBaseEvent: ResolverEvent; | ||
beforeEach(() => { | ||
mockBaseEvent = {} as ResolverEvent; | ||
function dnsRelatedEventEntry() { | ||
const fakeEvent = {} as ResolverEvent; | ||
return { relatedEvent: fakeEvent, relatedEventType: 'dns' }; | ||
} | ||
const payload: Map<ResolverEvent, RelatedEventDataEntry> = new Map([ | ||
[ | ||
mockBaseEvent, | ||
{ | ||
relatedEvents: [dnsRelatedEventEntry(), dnsRelatedEventEntry()], | ||
}, | ||
], | ||
]); | ||
const action: DataAction = { type: 'serverReturnedRelatedEventData', payload }; | ||
store.dispatch(action); | ||
}); | ||
it('should compile stats reflecting a count of 2 for dns', () => { | ||
const actualStats = relatedEventStats(store.getState()); | ||
const statsForFakeEvent = actualStats.get(mockBaseEvent)! as RelatedEventDataEntryWithStats; | ||
expect(statsForFakeEvent.stats).toEqual({ dns: 2 }); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.