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
42 lines (39 loc) · 1001 Bytes
/
EventPluginTestFixture.ts
File metadata and controls
42 lines (39 loc) · 1001 Bytes
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
37
38
39
40
41
42
import { ContextData } from '../ContextData';
import { EventPluginContext } from '../EventPluginContext';
import { IEvent } from '../../models/IEvent';
import { IErrorParser } from '../../services/IErrorParser';
// TODO: This should use the real object instances and inject the error parser.
export function createFixture() {
let contextData: ContextData;
let context: EventPluginContext;
let errorParser: IErrorParser;
let client: any;
let event: IEvent;
errorParser = {
parse: (c: EventPluginContext, exception: Error) => ({
type: exception.name,
message: exception.message,
stack_trace: (<any>exception).testStack || null
})
};
client = {
config: {
dataExclusions: [],
errorParser,
log: {
info: () => { }
}
}
};
event = {
data: {}
};
contextData = new ContextData();
context = new EventPluginContext(client, event, contextData);
return {
contextData,
context,
client,
event
};
}