forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventPluginTestFixture.ts
More file actions
36 lines (34 loc) · 1.01 KB
/
EventPluginTestFixture.ts
File metadata and controls
36 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { IEvent } from '../../models/IEvent';
import { IErrorParser } from '../../services/IErrorParser';
import { ContextData } from '../ContextData';
import { EventPluginContext } from '../EventPluginContext';
// TODO: This should use the real object instances and inject the error parser.
export function createFixture(): { contextData: ContextData, context: EventPluginContext, client: any, event: IEvent } {
const errorParser: IErrorParser = {
parse: (c: EventPluginContext, exception: Error) => ({
type: exception.name,
message: exception.message,
stack_trace: (exception as any).testStack || null
})
};
const client: any = {
config: {
dataExclusions: [],
errorParser,
log: {
info: () => { }
}
}
};
const event: IEvent = {
data: {}
};
const contextData: ContextData = new ContextData();
const context: EventPluginContext = new EventPluginContext(client, event, contextData);
return {
contextData,
context,
client,
event
};
}