Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security_Solution][Bug] Fix user name/domain to ECS structure #73530

Merged
merged 8 commits into from
Jul 29, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { eventType, orderByTime } from './process_event';
import { eventType, orderByTime, userInfoForProcess } from './process_event';

import { mockProcessEvent } from './process_event_test_helpers';
import { LegacyEndpointEvent, ResolverEvent } from '../../../common/endpoint/types';
Expand All @@ -24,6 +24,22 @@ describe('process event', () => {
expect(eventType(event)).toEqual('processCreated');
});
});
describe('userInfoForProcess', () => {
let event: LegacyEndpointEvent;
beforeEach(() => {
event = mockProcessEvent({
user: {
name: 'aaa',
domain: 'bbb',
},
});
});
it('returns the right user info for the process', () => {
const { name, domain } = userInfoForProcess(event)!;
expect(name).toEqual('aaa');
expect(domain).toEqual('bbb');
});
});
describe('orderByTime', () => {
let mock: (time: number, eventID: string) => ResolverEvent;
let events: ResolverEvent[];
Expand Down